Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/funksiya-raqamlar-yigindisi-eng-katta

Sum of the digits

Easy 1000 ms 128 MB 29%
Share

Write a function DigitSum(x) that returns the sum of the digits of the positive integer $x$.

Example 1: DigitSum(123) → 6 — $1 + 2 + 3 = 6$.

Example 2: DigitSum(9045) → 18

Write only the function body.

A number goes into the function DigitSum, which returns the sum of its digits

Input

One line with a positive integer $x$ — the argument of the function.

Output

The value returned by the function: an integer.

Note

$1 \le x \le 10^{15}$

Examples

Input #1
123
Output #1
6
Input #2
9045
Output #2
18

Sign in to submit a solution

Signing up is free and takes a minute.