시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 1024 MB 9 7 6 75.000%

문제

A standard microwave is operated by entering the cooking time as a string in the form of hhmmss, where hh, mm, and ss are two-digit integers less than 24, 60, and 60, respectively. Leading zeros in the string hhmmss are omitted. For example, the cooking time of 3 minutes is entered as 300, though 0300 or 00300 is also accepted.

When any of hh, mm, or ss exceeds the limit, the microwave will not accept it as a valid cooking time and gives an error. For example, 75 is not accepted, nor is 240000. Note that for the purpose of this problem, we assume that zero seconds of cooking time (represented by a sequence of zero or more 0’s) is valid.

Sometimes, one might make a mistake by omitting a digit while entering the cooking time. For example, while entering 1030 (10 minutes and 30 seconds), omitting the digit 3 turns the input time into 100 (1 minute) instead. Omitting the digit 1 turns it into 030 (30 seconds). In this case, omitting any of the four digits will still make the resulting string a valid cooking time. However, some other strings, while valid cooking times themselves, can become invalid when exactly one of the digits is omitted. For example, 1700 (17 minutes) becomes invalid if either of the zeros is omitted. Such strings are called Error-Prone cooking times.

Now, imagine some extraterrestrial planet, on which a standard microwave is operated by a string in the form $a_1a_2a_3 \dots a_n$, where each of $a_1, a_2, \dots , a_n$ is a two-digit non-negative integer (somehow they also use base 10) less than limits $t_1, t_2, \dots , t_n$, respectively. The rules of valid and invalid cooking time still hold.

Given limits $t_1, t_2, \dots , t_n$, find the number of Error-Prone cooking times. Note that leading zeros don’t change the cooking time, so a time specification like 066 is the same as 66, and should not be counted twice. Also note that 0 is a legitimate cooking time.

입력

The first line of input contains an integer $n$ ($1 \le n \le 9$), which is the number of time types in the alien time scheme.

Each of the next $n$ lines contains an integer $t_i$ ($1 \le t_i \le 100$), which is the number of partitions in the $i$th time type in the alien scheme.

출력

Output a single integer, which is the number of Error-Prone cooking times without leading zeros.

예제 입력 1

3
24
60
60

예제 출력 1

51840