Having learned the multiplication table, Takahashi can multiply two integers between 1…
- User
Having learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.
Given are two integers A and B.
If Takahashi can calculate A \times B, print the result; if he cannot, print
-1instead.Constraints
- 1 \leq A \leq 20
- 1 \leq B \leq 20
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
If Takahashi can calculate A \times B, print the result; if he cannot, print
-1.Examples
Input
2 5
Output
10
Input
5 10
Output
-1
Input
9 9
Output
81
Assistant
We need to solve the problem: Given A and B between 1 and 20 inclusive, if both A and B are between 1 and 9 inclusive (since Takahashi knows multiplication table only for numbers 1..9), then output A*B, else output -1.
Check constraints: A and B can be up to 20, but only if both <=9 then product, else -1.
Implementation: read A and B as ints. If A <= 9 and B <= 9: print(A*B) else print(-1).
Edge cases: A=1, B=20 => -1; A=9, B=9 => 81; A=10, B=10 => -1; etc.
That's simple.
We need to output result.
We'll produce final answer.
I'll write solution in Python.
Make sure to handle input correctly.
Now produce final message. ```python
def main(): import sys A, B = map(int, sys.stdin.readline().split()) if 1 <= A <= 9 and 1 <= B <= 9: print(A * B) else: print(-1)
if name == "main": main()