The Expression from the Numbers
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
This is enough known task from mathematics: how can you with the help of 5 numbers of 2, signs of arithmetic operations and brackets to write down a number 7?
It can be done such as (2 + 2 * 2) + 2 / 2, or as 22 / 2 - 2 * 2 or as 2 * (2 + 2) – 2 / 2.
And you have to know what least natural number m can not be given such method, if you can use n numbers of the number d?
Note: A division is executed entirely.
Input
The natural numbers n and d are given in the one line (1 ≤ n ≤ 7, 1 ≤ d ≤ 9).
Output
You have to write the number m - the least number which can not be given as arithmetic expression if you can use n times the number d.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 25%