Chilly Willy loves playing with numbers. He only knows prime numbers that are digits yet. These numbers are 2, 3, 5 and 7. But Willy grew rather bored of such numbers, so he came up with a few games that were connected with them.

Chilly Willy wants to find the minimum number of length n, such that it is simultaneously divisible by all numbers Willy already knows (2, 3, 5 and 7). Help him with that.

A number's length is the number of digits in its decimal representation without leading zeros.


-----Input-----

A single input line contains a single integer n (1 ≤ n ≤ 10^5).


-----Output-----

Print a single integer — the answer to the problem without leading zeroes, or "-1" (without the quotes), if the number that meet the problem condition does not exist.


-----Examples-----
Input
1

Output
-1

Input
5

Output
10080

Source: codeforces | Difficulty: MEDIUM
Tags: Number theory

Mathematics


Solutions:
n = int(input())
if n < 3:
	print(-1)
else:
	a = 210
	x = int('1' + '0' * (n - 1))
	(div, mod) = (x // a, x % a)
	if mod > 0:
		div += 1
	print(div * 210)


n = int(input())
if n == 1 or n == 2:
	print(-1)
elif n == 3:
	print(210)
else:
	a = str(1)
	for i in range(n - 1):
		a = a + str(0)
	a = int(a)
	for i in range(a, a + 211, 10):
		if i % 210 == 0:
			print(i)
			break


n = int(input())
if n < 3:
	print(-1)
else:
	x = int('1' + '0' * (n - 1))
	x = x + (210 - x % 210)
	print(x)


n = int(input())
if n < 3:
	print(-1)
else:
	x = 10 ** (n - 1)
	d = x % 210
	x -= d
	x += 210
	print(x)


n = int(input()) - 1
k = 10 ** n
m = 210 - k % 210
print(k + m if m < 9 * k else -1)


n = int(input())
if n < 3:
	print('-1')
else:
	num = 10 ** (n - 1)
	while num % 210:
		num = num + 1
	print(num)


n = int(input())
if n <= 2:
	print(-1)
else:
	s = 10 ** (n - 1)
	print(s + 210 - s % 210)


num = 210
digits = 3
curr = 1000
n = int(input())
if n < 3:
	print(-1)
elif n == 3:
	print(num)
else:
	n -= 1
	k = 10 ** n // 210
	print(210 * (k + 1))


n = int(input())
if n < 3:
	print(-1)
	exit()
else:
	x = n % 6
	if x == 0:
		res = 10 ** 5 + 20
	elif x == 1:
		res = 10 ** 6 + 20
	elif x == 2:
		res = 10 ** 7 + 20
	else:
		res = 10 ** (x - 1) + 20
tmp = 0
while res % 7:
	res += 30
	tmp += 30
if n <= 8:
	print(res)
else:
	res = str(20 + tmp)
	print('1' + '0' * (n - 1 - len(res)) + res)


x = int(input())
for i in range(10 ** (x - 1), 10 ** x):
	if i % 210 == 0:
		print(i)
		exit(0)
print(-1)


n = int(input())
if n <= 2:
	print(-1)
else:
	ret = 10 ** (n - 1)
	print(ret + 210 - ret % 210)


n = int(input())
if n == 1 or n == 2:
	print(-1)
elif n == 3:
	print(210)
else:
	a = 10 ** (n - 1)
	if a % 210 == 0:
		print(a)
	else:
		print((a // 210 + 1) * 210)


n = int(input())
b = 2 * 3 * 5 * 7
a = b * (10 ** (n - 1) // b + 1)
if a >= 10 ** n:
	print(-1)
else:
	print(a)


def quickPow(a, b):
	res = 1
	while b:
		if b & 1:
			res = res * a
		a = a * a
		b >>= 1
	return res
n = int(input())
if n == 1 or n == 2:
	print(-1)
else:
	n = quickPow(10, n - 1)
	while 1:
		if n % 210 == 0:
			print(n)
			break
		n += 1


n = int(input())

def printans(n):
	if n == 1:
		print(-1)
		return
	if n == 2:
		print(-1)
		return
	if n == 3:
		print(210)
		return
	if n == 4:
		print(1050)
		return
	k = ''
	p = n
	p %= 6
	if p == 1:
		k = '1' + '0' * (n - 3) + '2'
	if p == 2:
		k = '1' + '0' * (n - 4) + '20'
	if p == 3:
		k = '1' + '0' * (n - 4) + '11'
	if p == 4:
		k = '1' + '0' * (n - 3) + '5'
	if p == 5:
		k = '1' + '0' * (n - 3) + '8'
	if p == 0:
		k = '1' + '0' * (n - 4) + '17'
	print(k + '0')
printans(n)


import math

def check(i):
	return i % 2 == 0 and i % 3 == 0 and (i % 5 == 0) and (i % 7 == 0)
n = int(input())
temp = 10 ** (n - 1)
m = 10 ** n
while check(temp) == 0:
	temp += 1
if temp > m:
	print(-1)
else:
	print(temp)


def cat(n):
	if n < 3:
		return -1
	return 210 * (10 ** (n - 1) // 210 + 1)
print(cat(int(input())))


n = int(input())
if n == 1 or n == 2:
	print('-1')
else:
	num = pow(10, n - 1)
	k = num // 7
	m = k % 30
	k = k - m
	print(7 * (k + 30))


a = int(input())
x = 10 ** (a - 1) % 210
print(10 ** (a - 1) + (210 - x) if a > 2 else -1)


n = int(input()) - 1
if n > 1:
	print(10 ** n + ([1, 1] + [110, 50, 80, 170, 20, 200] * 16667)[n])
else:
	print(-1)


import math
n = int(input())
if n < 3:
	print('-1')
else:
	x = 210
	num = '1' + '0' * (n - 1)
	num = int(num)
	rem = int(num % 210)
	ans = 210 - rem
	print(num + ans)


n = int(input())
if n == 1 or n == 2:
	print(-1)
else:
	p = 10 ** (n - 1)
	m = p % 210
	p = p - m
	p = p + 210
	print(p)


n = int(input())
s = 10 ** (n - 1)
while s % 21 != 0:
	s += 10
if n > 2:
	print(s)
else:
	print(-1)


n = int(input())
if n < 3:
	print(-1)
else:
	k = int(pow(10, n - 1))
	l = k + 210 - k % 210
	print(l)


n = int(input())
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	suff = ''
	if n % 6 == 4:
		suff = '50'
	elif n % 6 == 5:
		suff = '80'
	elif n % 6 == 0:
		suff = '170'
	elif n % 6 == 1:
		suff = '20'
	elif n % 6 == 2:
		suff = '200'
	elif n % 6 == 3:
		suff = '110'
	main = n - 1 - len(suff)
	print('1' + '0' * main + suff)


n = int(input())
if n <= 2:
	print(-1)
elif n == 3:
	print(210)
else:
	x = 2 * pow(10, n - 1, 21) % 21
	(a, b) = (x // 10, x % 10)
	print('1' + '0' * (n - 4) + str(a) + str(b) + '0')


n = int(input())
min = 10 ** (n - 1)
if n == 1 or n == 2:
	print(-1)
else:
	while min % 210 != 0:
		min += 1
	print(min)


n = int(input())
if n < 3:
	print(-1)
else:
	print((10 ** (n - 1) // 210 + 1) * 210)


n = int(input())
k = -1
if n >= 3:
	k = 210 * (10 ** (n - 1) // 210 + 1)
print(k)


N = int(input())
if N >= 3:
	print(210 - 10 ** (N - 1) % 210 + 10 ** (N - 1))
else:
	print('-1')


n = int(input())
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	k = 210 - 10 ** (n - 1) % 210
	print(10 ** (n - 1) + k)


n = int(input())
if n <= 2:
	print(-1)
else:
	s = pow(10, n - 1)
	while 1:
		if s % 210 == 0:
			print(s)
			break
		else:
			s += 10


i = input().strip()
i = int(i)
n = pow(10, i - 1)
rem = n % 210
ans = n - rem + 210
if ans > n - 1 and ans < pow(10, i):
	print(ans)
else:
	print(-1)


def mod(a, b, m):
	if b == 1:
		return a % m
	elif b % 2 == 0:
		b = b // 2
		x = mod(a, b, m)
		return x * x % m
	else:
		b = b - 1
		return a % m * mod(a, b, m) % m
size = int(input())
if size < 3:
	print(-1)
else:
	rem = mod(10, size - 1, 210)
	ans = pow(10, size - 1) + (210 - rem)
	print(ans)


n = int(input())
if n <= 2:
	print(-1)
else:
	res = 10 ** (n - 1) // 210 + 1
	print(210 * res)


n = int(input())
flag = 0
for i in range(10 ** (n - 1), 10 ** n):
	if i % 2 == 0 and i % 3 == 0 and (i % 5 == 0) and (i % 7 == 0):
		print(i)
		flag = 1
		break
if flag == 0:
	print(-1)


import math
n = int(input())
if n < 3:
	print(-1)
if n == 3:
	print(210)
if n > 3:
	a = 10 ** (n - 1)
	for i in range(1, 10 ** 9):
		if a % 210 == 0:
			print(a)
			break
		a += 1


n = int(input())
if n < 3:
	print('-1')
elif n == 3:
	print(210)
else:
	x = 10 ** (n - 1)
	while True:
		if x % 210 == 0:
			print(x)
			break
		x += 1


n = int(input())
const = 2 * 3 * 5 * 7
if n < 3:
	print(-1)
else:
	print((10 ** (n - 1) // const + 1) * const)


n = int(input())
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	x = 7 - [1, 3, 2, 6, 4, 5][(n - 1) % 6]
	if x % 2 == 1:
		x += 7
	while (x + 1) % 3 != 0 or x % 5 != 0:
		x += 14
	print(10 ** (n - 1) + x)


n = int(input())
if n < 3:
	print(-1)
elif n == 3:
	print(210)
elif n == 4:
	print(1050)
else:
	fl = 0
	hs = [3, 2, 6, 4, 5, 1]
	ans = []
	for i in range(10):
		for j in range(10):
			if (i + j + 1) % 3 == 0:
				g = 0
				if (n - 4) % 6 == 0:
					g = 6
				else:
					g = (n - 4) % 6
				if (1000 * hs[g - 1] + 100 * i + 10 * j) % 7 == 0:
					fl = 1
					ans = [i, j]
					break
		if fl == 1:
			break
	li = ['1']
	li += ['0'] * (n - 4)
	print(''.join(li), end='')
	print(ans[0], ans[1], '0', sep='')


n = int(input())
if n <= 2:
	print(-1)
else:
	no = 10 ** (n - 1)
	while no % 210 != 0:
		no += 1
	print(no)


import math
n = int(input())
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	print(str(pow(10, n - 1) + 210 - (pow(10, n - 1) + 210) % 210))


x = 0
n = int(input()) - 1
for i in range(10 ** n, 10 ** (n + 1)):
	if i % 210 == 0:
		print(i)
		x = 1
		break
if x == 0:
	print('-1')


n = int(input()) - 1
if n < 2:
	print(-1)
elif n == 2:
	print(210)
else:
	k = str(210 - 10 * pow(10, n - 1, 21))
	print('1' + '0' * (n - len(k)) + k)


n = int(input())
tmp = n
n = 10 ** (n - 1)
if tmp == 1 or tmp == 2:
	print('-1')
else:
	for i in range(n, n + 400):
		if i % 210 == 0:
			print(i)
			break


n = int(input())
if n == 1 or n == 2:
	print(-1)
else:
	i = 1
	n = int(pow(10, n - 1))
	n = n // 210
	print(210 * (n + 1))


n = int(input())
if n <= 2:
	print(-1)
elif n == 3:
	print(210)
else:
	r = pow(10, n - 1) % 210
	print(pow(10, n - 1) + 210 - r)


n = int(input())
if n < 3:
	print(-1)
	exit()
d = 10 ** (n - 1)
a = d % 210
d += 210 - a
print(d)


n = int(input())
m = 10 ** (n - 1)
if n < 3:
	print('-1')
else:
	for i in range(m, m + 501, 1):
		if i % 210 == 0:
			print(i)
			break


n = int(input())
ti = 1
if n <= 2:
	print(-1)
	return
n -= 2
ti = 10 ** n
if ti % 21:
	ti //= 21
	ti += 1
	ti *= 21
ti *= 10
print(ti)


x = int(input())
if x in [1, 2]:
	print(-1)
elif x == 3:
	print(210)
else:
	print('1' + '0' * (x - 4 + 3 - len(str(210 - pow(10, x - 1, 210)))) + str(210 - pow(10, x - 1, 210)))


n = int(input())
if n < 3:
	print(-1)
	exit()
cur = 10 ** (n - 1)
ans = 2 * 3 * 5 * 7
nex = cur // ans
print(ans * (nex + 1))


n = int(input())
(c, d) = (10 ** (n - 1), 210)
if n <= 2:
	print(-1)
else:
	print(210 * (10 ** (n - 1) // 210 + 1))


n = int(input())
if n < 3:
	print(-1)
else:
	ans = pow(10, n - 1) + (210 - pow(10, n - 1) % 210)
	print(ans)


x = int(input())
n = 2 * 3 * 5 * 7
if x <= 2:
	print(-1)
else:
	x = 10 ** (x - 1)
	if x % n == 0:
		print(x)
	else:
		print((x // n + 1) * n)


from fractions import gcd
from random import randint

def __starting_point():
	n = int(input())
	if n < 3:
		print(-1)
		return
	res = 210 - 10 ** (n - 1) % 210 + 10 ** (n - 1)
	print(res)
__starting_point()


a = int(input())
c = True
if a < 3:
	print(-1)
elif a == 3:
	print(210)
else:
	e = pow(10, a - 1)
	while c:
		if e % 210 == 0:
			print(e)
			c = False
			break
		else:
			e += 10


import math

def main():
	n = int(input())
	if n == 1 or n == 2:
		print(-1)
		return 0
	if n == 3:
		print(210)
		return 0
	rem = pow(10, n - 1) % 210
	res = pow(10, n - 1) + 210 - rem
	print(res)
main()


import sys
n = int(input())
if n == 1 or n == 2:
	print(-1)
	sys.exit()
if n == 3:
	print(210)
	sys.exit()
ans = 10 ** (n - 1)
md = ans % 210
ans = 210 - md + ans
print(ans)


n = int(input()) - 1
if n < 2:
	print(-1)
else:
	z = 10 ** n
	print(210 + z - z % 210)


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	if n <= 2:
		print(-1)
	else:
		print(210 * (pow(10, n - 1) // 210 + 1))
main()


import math
n = int(input())
if n <= 2:
	print(-1)
else:
	print(210 * ((10 ** (n - 1) + 209) // 210))


from fractions import gcd
from random import randint
n = int(input())
if n < 3:
	print(-1)
	exit(0)
res = 210 - 10 ** (n - 1) % 210 + 10 ** (n - 1)
print(res)


n = int(input())
start = pow(10, n - 1)
end = pow(10, n)
ans = -1
for i in range(start, end):
	if i % 2 == 0 and i % 3 == 0 and (i % 5 == 0) and (i % 7 == 0):
		ans = i
		break
print(ans)


n = int(input())
if n == 1 or n == 2:
	print('-1')
elif n == 3:
	print('210')
else:
	n = n - 1
	p = pow(10, n)
	print(p + 210 - p % 210)


import math
n = int(input())
s = 0
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	s = 10 ** (n - 1)
	while 1:
		if s % 2 == 0 and s % 3 == 0 and (s % 5 == 0) and (s % 7 == 0):
			print(s)
			break
		else:
			s += 1


import sys, os.path
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = int(input())
lcm = 2 * 3 * 5 * 7
if n == 1 or n == 2:
	print(-1)
	exit()
h = 10 ** (n - 1)
h += lcm
ans = h - h % lcm
print(ans)


from sys import *
from math import *

def mod(a, m):
	x = 0
	for i in reversed(a):
		x = (x * 10 + int(i)) % m
	r = []
	t = m - x
	while t > 0:
		r.append(t % 10)
		t //= 10
	return r

def main():
	n = int(input())
	k = 2 * 3 * 5 * 7
	if n < 3:
		print(-1)
		return 0
	elif n == 3:
		print(k)
	else:
		t = [1 if i == 0 else 0 for i in range(n)]
		t = t[::-1]
		r = mod(t, k)
		c = 0
		for i in range(len(r)):
			t[i] = r[i]
		for i in reversed(t):
			print(i, end='')
main()


import math

def quickPow(a, b):
	res = 1
	while b:
		if b & 1:
			res = res * a
		a = a * a
		b >>= 1
	return res
n = int(input())
if n == 1 or n == 2:
	print(-1)
else:
	a = 210
	r = quickPow(10, n - 1)
	for i in range(r, r + 211):
		if i % a == 0:
			print(i)
			break


n = int(input())
if n < 3:
	print(-1)
	exit(0)
if n == 3:
	print(210)
	exit(0)
ans = 50
for _ in range(n - 4):
	ans = ans * 10 % 210
s = str(ans)
print('1' + '0' * (n - len(s) - 1) + s)


import sys
from math import log2, floor, ceil, sqrt
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
n = int(ri())
val = 210
if n <= 2:
	print(-1)
elif n == 3:
	print(210)
else:
	rem = 10 ** (n - 1) % val
	if rem == 0:
		print(1, end='')
		for i in range(n - 1):
			print(0, end='')
		print()
	else:
		rem = 210 - rem
		rem = str(rem)
		print(1, end='')
		for i in range(n - 1 - len(rem)):
			print(0, end='')
		print(rem)


from sys import *
from math import *
n = int(stdin.readline())
ans = -1
if n > 2:
	x = 10 ** (n - 1)
	ans = 210 * (x // 210 + 1)
print(ans)


def parser():
	while 1:
		data = list(input().split(' '))
		for number in data:
			if len(number) > 0:
				yield number
input_parser = parser()

def get_word():
	global input_parser
	return next(input_parser)

def get_number():
	data = get_word()
	try:
		return int(data)
	except ValueError:
		return float(data)
a = get_number()
if a < 3:
	print(-1)
else:
	ans = 10 ** (a - 1)
	print(ans + 210 - ans % 210)


class CodeforcesTask248BSolution:

	def __init__(self):
		self.result = ''
		self.n = 0

	def read_input(self):
		self.n = int(input())

	def process_task(self):
		if self.n < 3:
			self.result = '-1'
		else:
			res = 10 ** (self.n - 1) // 210 * 210 + (210 if 10 ** (self.n - 1) % 210 else 0)
			self.result = str(res)

	def get_result(self):
		return self.result
Solution = CodeforcesTask248BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
if n <= 2:
	print(-1)
elif n == 3:
	print(210)
else:
	k = 10 ** (n - 1)
	while True:
		if k % 210 == 0:
			print(k)
			break
		k += 1


n = int(input())
k = True
if n < 3:
	print(-1)
	k = False
if k:
	x = 10 ** (n - 1)
	while x % 210 != 0:
		x += 1
	print(x)


n = int(input())
if n == 1 or n == 2:
	print(-1)
elif n == 3:
	print(210)
else:
	x = 10 ** (n - 1)
	while x % 210 != 0:
		x = x + 1
	print(x)


n = int(input())
x = 10 ** (n - 1)
res = x + 210 - x % 210
if res % 210 == 0 and res >= x and (res <= x * 10):
	print(res)
else:
	print(-1)


n = int(input())
if n < 3:
	print(-1)
	exit(0)
gg = 10 ** (n - 1)
r = gg % 210
gg += 210 - r
print(gg)


def first_divisible(n):
	start = 10 ** (n - 1)
	end = start * 10
	for i in range(start, end):
		if i % 210 == 0:
			break
	return i
n = int(input())
end = 10 ** n
i = first_divisible(n)
if i >= end - 1:
	print(-1)
	exit(0)
print(i)


def mypow(a, b):
	base = a
	res = 1
	while b:
		if b & 1:
			res *= base
		base *= base
		b >>= 1
	return res

def sol(n):
	sum = mypow(10, n - 1)
	for i in range(sum, sum + 210 + 1, 1):
		if i % 210 == 0:
			return i
n = int(input())
if n < 3:
	print(-1)
else:
	print(sol(n))
	print


n = int(input())
if n <= 2:
	print(-1)
else:
	x = (10 ** (n - 1) + 209) // 210
	print(210 * x)


n = int(input())
if n < 3:
	print(-1)
	exit(0)
n = 10 ** (n - 1)
temp = n // 210
if n % 210:
	temp += 1
ans = temp * 210
print(ans)


n = int(input())
cur = 10 ** (n - 1)
correct = False
for count in range(cur, 10 ** n):
	if count % 210 == 0:
		print(count)
		correct = True
		break
if not correct:
	print('-1')


import re
import itertools
from collections import Counter

class Task:
	n = 0
	answer = ''

	def getData(self):
		self.n = int(input())

	def solve(self):
		n = self.n
		if n < 3:
			self.answer = '-1'
			return
		if n == 3:
			self.answer = '210'
			return
		tenRemainders = [1, 3, 2, 6, 4, 5]
		for x in range(0, 100):
			if (tenRemainders[(n - 1) % 6] + x * 10) % 7 == 0 and (1 + x // 10 + x % 10) % 3 == 0:
				self.answer = '1' + '0' * (n - 4)
				self.answer += '0' + str(x) if x < 10 else str(x)
				self.answer += '0'
				return

	def printAnswer(self):
		print(self.answer)
task = Task()
task.getData()
task.solve()
task.printAnswer()


n = input()
n = int(n)
x = -1
if n > 2:
	a = 1
	for i in range(10 ** (n - 1), 10 ** n):
		if i % 210 == 0:
			print(i)
			x = 1
			break
else:
	print('-1')


n = int(input())
n = n - 1
x = 10 ** n
m = 2 * 3 * 5 * 7
mod = x % m
x = x - mod
x = x + m
if x < 10 ** (n + 1):
	print(x)
else:
	print(-1)


NumLength = int(input())
tens = 100
if NumLength <= 2:
	print('-1')
elif NumLength == 3:
	print('210')
else:
	tens = tens * pow(10, NumLength - 3)
	tens = tens + 210 - tens % 210
	print(tens)


d = int(input())
if d == 1 or d == 2:
	print(-1)
else:
	lim = 10 ** (d - 1)
	k = lim // 210
	if 210 * k <= lim:
		k += 1
	print(210 * k)


n = int(input())
if n <= 2:
	print(-1)
else:
	print((pow(10, n - 1) // 210 + 1) * 210)


a = int(input())
if a < 3:
	print('-1')
else:
	m = 10 ** (a - 1)
	r = m % 210
	print(m - r + 210)


def fastExpMod(b, e):
	result = 1
	while e != 0:
		if e & 1 == 1:
			result = result * b
		e >>= 1
		b = b * b
	return result

def main():
	n = int(input())
	if n < 3:
		print(-1)
	else:
		x = fastExpMod(10, n - 1)
		while x % 210:
			x = x + 1
		print(x)
main()


import sys as system
n = int(input())
if n < 3:
	print(-1)
	system.exit(0)
if n == 3:
	print(210)
	system.exit(0)
ch = 10 ** (n - 1)
ost = ch % 210
if ost:
	ch += 210 - ost
print(ch)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	n = int(input())
	if n < 3:
		print(-1)
	elif n == 3:
		print(210)
	elif n == 4:
		print(1050)
	else:
		print('1' + '0' * (n - 5) + ['0080', '0170', '0020', '0200', '0110', '0050'][(n - 5) % 6])


n = int(input())
w = 2 * 3 * 5 * 7
k = 10 ** (n - 1)
if n <= 2:
	print(-1)
elif k % w == 0:
	print(k)
else:
	k += -k % w
	print(k)


n = int(input())
if n < 3:
	print(-1)
else:
	n -= 1
	i = 10 ** n
	while True:
		if i % 210 == 0:
			print(i)
			break
		i += 1


n = int(input())
val = pow(10, n - 1)
val2 = pow(10, n) - 1
if val2 // 120 == 0:
	print('-1')
elif val % 210 == 0:
	print(val)
else:
	print((val // 210 + 1) * 210)


n = int(input())
if n == 1 or n == 2:
	print(-1)
else:
	i = 10 ** (n - 1)
	i += 20
	while True:
		if i % 7 == 0:
			print(i)
			break
		else:
			i += 30


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime
n = int(input())
if n == 1 or n == 2:
	print(-1)
else:
	f = 0
	c = 210
	c = 10 ** (n - 1)
	r = 210 - c % 210
	ans = 10 ** (n - 1) + r
	print(ans)


import math as mt
import sys, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
from collections import defaultdict
n = I()
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	x = [50, 80, 170, 20, 200, 110]
	print('1' + '0' * (n - 1 - len(str(x[(n - 4) % 6]))) + str(x[(n - 4) % 6]))


import sys
for line in sys.stdin:
	n = int(line.strip())
	begin = 10 ** (n - 1)
	end = 10 ** n
	cont = -1
	for i in range(begin, end):
		if not i % 210:
			cont = i
			break
	print(cont)


n = int(input())
if n == 1 or n == 2:
	print(-1)
else:
	n -= 1
	print(10 ** n - 10 ** n % 210 + 210)


n = int(input())
ti = 1
if n <= 2:
	print(-1)
	exit(0)
n -= 2
ti = 10 ** n
if ti % 21:
	ti //= 21
	ti += 1
	ti *= 21
ti *= 10
print(ti)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	print(1, '0' * (n - 4), end='', sep='')
	n -= 4
	ans = {}
	ans[0] = '050'
	ans[1] = '080'
	ans[2] = '170'
	ans[3] = '020'
	ans[4] = '200'
	ans[5] = '110'
	print(ans[n % 6])
4 - 1050
5 - 10080
6 - 100170
7 - 1000020
8 - 10000200
9 - 100000110
10 - 1000000050


n = int(input())
a = 2 * 3 * 5 * 7
if n <= 2:
	print(-1)
else:
	r = 10 ** (n - 1) % a
	t = 210 - r + 10 ** (n - 1)
	print(t)


n = int(input())
if n < 3:
	print(-1)
	exit()
k = 10 ** (n - 1)
res = k + 210 - k % 210
print(res)


curr = 2 * 3 * 5 * 7
n = int(input())
num = 10 ** (n - 1)
if n == 3:
	print(210)
elif num < curr:
	print(-1)
else:
	rem = num % curr
	if rem != 0:
		num = num + curr - rem
	print(num)


n = int(input()) - 1
print(10 ** n + 210 - 10 * pow(10, n - 1, 21) if n > 1 else -1)


n = int(input())
rem = 10 ** (n - 1) % 210
var = 210 - rem
if n < 3:
	print(-1)
elif n == 3:
	print(210)
else:
	print(10 ** (n - 1) + var)


def main():
	n = int(input())
	if n < 3:
		print(-1)
	else:
		n -= 1
		p = n
		b = 10
		res = 1
		while p:
			if p & 1:
				res *= b
			b *= b
			p >>= 1
		for i in range(0, 1000):
			if (res + i) % 210 == 0:
				print(10 ** n + i)
				exit()
main()


n = int(input())
ans = -1
if n > 2:
	ans = 210 * (pow(10, n - 1) // 210 + 1)
print(ans)