Submit solution

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 1G

Author:
Problem type

You are given two positive integers, A and B. Define O_x as the decimal number consisting of x consecutive ones. For example, O_4 = 1111. Determine the number of ones in the decimal representation of O_A \times O_B.

Constraints

1 \le A, B \le 10^9

Subtask 1 [20%]

1 \le A, B \le 10^5

Subtask 2 [80%]

No additional constraints.

Input Specification

The first line contains two space-separated integers, A and B.

Output Specification

Output one line containing one integer, the number of ones in the decimal representation of O_A \times O_B.

Sample Input 1

3 5

Sample Output 1

2

Explanation for Sample 1

O_3 \times O_5 = 111 \times 11111 = \underline{1}23332\underline{1} \to 2 ones.

Sample Input 2

314159 265358

Sample Output 2

29486

Comments

There are no comments at the moment.