cswork / OAOpen practice workspace

UpstartOA #4

Find the Wrong Digit Index in a Sum

Estimated EasyJudge-ready

Topics (AI-labelled)Bits & Math

Compare the decimal digits of num1+num2 and givenSum, numbering positions from 0 starting at the ones digit; missing higher digits are treated as 0. Return the index of the first differing digit, or −1 if they are identical.

The standard input/output format and any supplementary ranges on this site are as stated in this problem.

Input

One line with three non-negative integers num1 num2 givenSum, each ≤10^18.

Output

Output the index of the first mismatched digit, or -1.

Example 1

Input:

13 7 19

Output:

0

Example 2

Input:

95 5 100

Output:

-1

Example 3

Input:

0 0 0

Output:

-1

Editorial

Loading solution…