#PCBSAU0000017. Tách các chữ số (Extract Four Digits)
Tách các chữ số (Extract Four Digits)
Extract Four Digits
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive four-digit integer , extract its thousands, hundreds, tens and units digits and calculate their sum.
Input
One line containing integer .
Output
Print the four digits from left to right, separated by spaces; on the second line print their sum.
Subtask
- Subtask 1 — 100 points: .
Example
Input
4729
Output
4 7 2 9
22
Explanation
The digits are , , , using integer division and modulo. Their sum is .