Olesya loves numbers consisting of n digits, and Rodion only likes numbers that are divisible by t. Find some number that satisfies both of them.
Your task is: given the n and t print an integer strictly larger than zero consisting of n digits that is divisible by t. If such number doesn't exist, print - 1.
Input
The single line contains two numbers, n and t (1 ≤ n ≤ 100, 2 ≤ t ≤ 10) — the length of the number and the number it should be divisible by.
Output
Print one such positive number without leading zeroes, — the answer to the problem, or - 1, if such number doesn't exist. If there are multiple possible answers, you are allowed to print any of them.
Examples
Input
3 2
Output
712
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
We need to output an integer with exactly n digits (no leading zero) that is divisible by t. n up to 100, t between 2 and 10.
This is a classic Codeforces problem: Given n and t, output a number of length n divisible by t. For t from 2 to 10. Since n can be large, constructing a string of digits is fine.
We need to check existence: When can we not find such a number? Only when it's impossible: If t = 10, then the number must end with 0. But if n = 1, the only possible digits are 1-9, none ending with 0, so impossible. For any other t (2..9) we can always construct: For example, a number consisting of n digits all equal to t? But careful: For t=5, number must end with 0 or 5. To avoid leading zero, we can use a leading digit not zero, e.g., '5' repeated n times? That would be divisible by 5? Not necessarily; e.g., 55 is divisible by 5, yes because ends with 5. Actually any number ending with 0 or 5 is divisible by 5. So if we put the last digit as 0 or 5, and ensure the number has n digits and no leading zero, we can do e.g., '5' + '0'*(n-1) or '5' repeated? But 5 repeated n times: e.g., 55 ends with 5 => divisible by 5. For t=2, number must be even; we can put last digit even, e.g., '2' and rest '1's or just '2' repeated? Actually 2 repeated n times: e.g., 22 even => divisible by 2. For t=3, any number with sum of digits divisible by 3. We can do something like '3' repeated n times: e.g., 33 sum=6 divisible by 3. But n=1: 3 divisible by 3. So that works. For t=4, divisibility by 4 depends on last two digits; we can set last two digits to be a multiple of 4 and first digits non-zero. For t=6, need even and divisible by 3. Use '6' repeated? 66: even, sum 12 divisible by 3, works. For t=7, we need a multiple of 7. Is there always a number of length n divisible by 7? Since we can choose digits arbitrarily, we can try to construct. But the problem statement says "If such number doesn't exist, print -1". For t=7 and n=1, we have digits 1-9: 7 is divisible by 7, so exists. For n=1, any t from 2 to 10: if t=10, no; otherwise there is at least one single-digit number divisible by t? For t=8, single digit 8 works; t=9, 9 works; t=2, 2,4,6,8; t=3, 3,6,9; t=4, 4,8; t=5,5; t=6,6; t=7,7; t=10 none. So only case with n=1 and t=10 is impossible. What about other cases? For n>1 and t=10, we can output '1' followed by (n-1) zeros, that gives a number like 10...0 (n digits), divisible by 10. So the only impossible case is n=1 and t=10.
But wait, are there any other tricky cases? For t= something like 8 and n=1, exists. So answer is simple: if n==1 and t==10: print -1. Otherwise, we can construct as:
If t < 10: output a string consisting of the digit t repeated n times. But check: For t=5, repeated n times works? For n=2: 55 divisible by 5? 55/5=11, yes. For n=3: 555/5=111, yes because ends with 5. For t=2: 222/2=111, yes. For t=3: 333/3=111, yes? 333/3=111, sum of digits 9 divisible by 3, works. For t=4: 444/4=111? 444/4=111, yes. Let's verify: 444 is divisible by 4? Actually 4111=444, so yes. But is 444 divisible by 4? Since 44 is divisible by 4, yes. For t=6: 666/6=111, works. For t=7: 777/7=111? 7111=777, yes. For t=8: 888/8=111, works. For t=9: 999/9=111, works. So indeed, for any t from 2 to 9, a number consisting of n copies of the digit t is divisible by t. But careful: For t=10, that would be digit '10' invalid. So that's a clean solution: output 't' repeated n times, except when t=10. But wait: t is up to 10. For t=10, if n>1, we can output '1' followed by n-1 zeros. That number is divisible by 10. Alternatively, we can output '10' repeated? Not digits. So that works. But is there any catch for t=10 when n=1? That's the only impossible. So solution is trivial.
But I recall the problem (Codeforces 495A) maybe? Actually there is problem "Olesya and Rodion" (CF 584A). The standard solution: if t == 10 then if n == 1 print -1 else print '1' + '0'*(n-1); else print str(t)*n.
But is there any situation where t=10 and n>1 but the number of zeros after 1 must be exactly n-1, giving an n-digit number: e.g., n=2 gives 10 (two digits) ok. So yes.
Double-check constraints: n up to 100, we can output a large string. So answer is simple.
Thus, the solution: read n and t. If t == 10 and n == 1: print -1. Else if t == 10: print '1' + '0'*(n-1). Else: print str(t)*n.
One nuance: For t from 2 to 9, repeated digit works. But what about t = 1? t >=2, so no.
Thus final output.
However, the example given: Input 3 2, Output 712. The problem statement examples sometimes show arbitrary answers. Here they gave 712, which is 3-digit, even. Our method would produce 222. That's also valid.
Now, I think we are done. But let me double-check: For t=4, repeated digit 4 works as we said. But is 4 repeated n always divisible by 4? For n=1: 4 divisible by 4; n=2: 44 divisible by 4 (44/4=11); n=3: 444 divisible by 4? 444/4 = 111? Let's compute 4111=444, yes. But wait, divisibility by 4: last two digits must be divisible by 4. For 444, last two digits are 44, divisible by 4. For n=4: 4444, last two digits 44, divisible by 4. So yes. So it works because the digit t repeated n yields last two digits = tt. For t=4, 44 is divisible by 4; for t=8, 88 is divisible by 8? But divisibility by 8 requires last three digits divisible by 8. However, 888 is divisible by 8? 8111 = 888, yes. But for n=1 or 2, we need to check. For t=8 and n=1: 8 divisible by 8; n=2: 88/8=11, yes; n=3: 888/8=111; So 8 repeated works because 8, 88, 888 etc are multiples of 8. In general, for t from 2 to 9, t repeated n gives number = t * (111...1) n times. Since 111...1 might not be integer? But number = t * (10^{n-1} + 10^{n-2} + ... + 1). That's clearly divisible by t. So indeed it's always divisible by t. So the condition is valid. For t=10, t111...1 would be 10111...1 = 111...10, which has a trailing zero and is n+1 digits? Actually if n repeats of digit 10 is not possible; but if we do t repeated as string "10" repeated n times would be 2n digits, not n. So we can't use that. So the special case for t=10 is needed.
Thus final solution.
But the problem statement also says "If there are multiple possible answers, you are allowed to print any of them." So we can output our constructed number.
Check n=100, t=9: output '9'*100 (a string of 100 nines). That's huge but okay as string.
Thus solution.
We need to print without leading zeroes; our constructions have first digit non-zero.
Now, some might worry about t=10, n=1: print -1.
Implementation: read n, t as integers. If t == 10:
if n == 1: print(-1)
else: print('1' + '0'*(n-1))
else:
print(str(t)*n)
But wait: what about t=10 and n>1: output '1' + '0'*(n-1) yields n-digit number starting with 1 and ending with zeros. That's divisible by 10.
Alternatively, could output '10' + '0'*(n-2)? That would be more complicated. Our simple method works.
So final code.
But I should check: For t=10 and n=2: print '10' -> that's two digits, divisible by 10. Our method would print '1' + '0' -> '10', same. For n=3: '100', works.
All good.
Thus answer. ```python
def main():
import sys
data = sys.stdin.read().strip().split()
if not data:
return
n = int(data[0])
t = int(data[1])
code
if t == 10:
if n == 1:
print(-1)
else:
print('1' + '0' * (n - 1))
else:
print(str(t) * n)