Digit Sum DifferenceEasy

Digit Sum Difference

Easy+10 XP · +5 Auramathdigitsloops

UptoSkills Arena's new intern, Priya, is learning about digits. She's fascinated by how we can treat numbers as sequences of digits. For a given positive integer, she wants to calculate a special value: the difference between the sum of digits at even positions and the sum of digits at odd positions. Positions are counted from left to right, starting at 1. For example, in the number 12345, the digit 1 is at position 1 (odd), 2 is at position 2 (even), 3 is at position 3 (odd), 4 is at position 4 (even), and 5 is at position 5 (odd). The even-position sum is 2 + 4 = 6. The odd-position sum is 1 + 3 + 5 = 9. The difference is 6 - 9 = -3.

Input

A single line containing a positive integer N.

Output

A single integer representing the difference (sum of even-positioned digits - sum of odd-positioned digits).

Constraints

1 <= N <= 1000

Time limit 1 s (native code; slower languages get more)Memory 256 MB14 hidden tests

Example 1

Input
12345
Output
-3

Even positions (2, 4) sum to 2+4=6. Odd positions (1, 3, 5) sum to 1+3+5=9. Difference is 6-9 = -3.

Example 2

Input
8
Output
-8

Even positions sum to 0. Odd positions sum to 8. Difference is 0-8 = -8.

Hints