题目描述
Problem Description
Takahashi is thinking about inputting an integer $ N $ using a keyboard.
Takahashi uses his left hand for the digits 1, 2, 3, 4, 5 and his right hand for the digits 6, 7, 8, 9, 0.
The time it takes for Takahashi to input each digit is as follows:
- When the digit to be input is the first digit of the integer, it takes $ 500 $ms regardless of the digit.
- Otherwise, if the digit to be input is the same as the previous digit, it takes $ 301 $ms.
- If neither of the above conditions are met and the digit to be input is typed with the same hand as the previous digit, it takes $ 210 $ms.
- In all other cases, it takes $ 100 $ms.
The time it takes to input the integer is the sum of the times it takes to input each digit. Calculate how many milliseconds it takes for Takahashi to input the integer $ N $.
Input Format
The input is given from the standard input in the following format:
$ N $
Output Format
Output the answer.
Sample Input and Output
Sample Input #1
1120
Sample Output #1
1111
Sample Input #2
8
Sample Output #2
500
Sample Input #3
12345678901234567890
Sample Output #3
4160
Notes/Hints
Constraints
- $1 \leq N < 10^{200000}$
- The leading digit of $ N $ is not $ 0 $.
- $ N $ is an integer.
Sample Explanation 1
- First, it takes $ 500 $ms to input the leading digit
1. - The next digit is also
1, which is the same as the previous digit, so it takes $ 301 $ms to input it. - The next digit is
2, which is different from the previous digit but typed with the same hand, so it takes $ 210 $ms to input it. - The last digit is
0, which is different from the previous digit and typed with a different hand, so it takes $ 100 $ms to input it.
Therefore, it takes a total of $ 500 + 301 + 210 + 100 = 1111 $ms to input1120.
Sample Explanation 2
Since $ N $ consists of only one digit, the time it takes to input it is equal to the time it takes to input the leading digit, which is $ 500 $ms.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
1120
样例输出
1111