Alice became interested in periods of integer numbers. We say positive $X$ integer number is periodic with length $L$ if there exists positive integer number $P$ with $L$ digits such that $X$ can be written as $PPPP…P$. For example:

$X = 123123123$ is periodic number with length $L = 3$ and $L = 9$

$X = 42424242$ is periodic number with length $L = 2,L = 4$ and $L = 8$

$X = 12345$ is periodic number with length $L = 5$

For given positive period length $L$ and positive integer number $A$, Alice wants to find smallest integer number $X$ strictly greater than $A$ that is periodic with length L.


-----Input-----

First line contains one positive integer number $L \ (1 \leq L \leq 10^5)$ representing length of the period. Second line contains one positive integer number $A \ (1 \leq A \leq 10^{100 000})$.


-----Output-----

One positive integer number representing smallest positive number that is periodic with length $L$ and is greater than $A$.


-----Examples-----
Input
3
123456

Output
124124

Input
3
12345

Output
100100



-----Note-----

In first example 124124 is the smallest number greater than 123456 that can be written with period L = 3 (P = 124).

In the second example 100100 is the smallest number greater than 12345 with period L = 3 (P=100)

Difficulty: MEDIUM_HARD
Tags: String algorithms

Implementation

Starter code:

Solutions:
n = int(input())
s = input()
ans = s[:n]
if n == len(s):
	ans = list(ans)
	for i in range(n - 1, -1, -1):
		if ans[i] != '9':
			ans[i] = chr(ord(ans[i]) + 1)
			break
		else:
			ans[i] = chr(ord('0'))
	ans = ''.join(ans)
	print(ans)
elif len(s) % n or ans == '9' * n:
	print(('1' + '0' * (n - 1)) * (len(s) // n + 1))
else:
	ch = 1
	for i in range(n, len(s) - n + 1, n):
		if s[:n] > s[i:i + n]:
			ch = 0
			break
	if ch:
		ans = list(ans)
		for i in range(n - 1, -1, -1):
			if ans[i] != '9':
				ans[i] = chr(ord(ans[i]) + 1)
				break
			else:
				ans[i] = chr(ord('0'))
		ans = ''.join(ans)
	print(ans * (len(s) // n))


k = int(input())
s = input()
(n, s1) = (len(s), s[:k])
p = n // k
if k > n:
	print('1' + (k - 1) * '0')
else:
	if n % k:
		p += 1
	s2 = s1 * p
	if len(s2) > len(s):
		s1 = '1' + (k - 1) * '0'
		print(p * s1)
	elif s2 > s:
		print(s2)
	else:
		f = 0
		for i in range(k - 1, -1, -1):
			if s1[i] != '9':
				f = 1
				ch = s1[i]
				s1 = s1[:i] + chr(ord(ch) + 1) + (k - 1 - i) * '0'
				break
		s2 = s1 * p
		if f:
			print(s2)
		else:
			s1 = '1' + (k - 1) * '0'
			if p * k == n:
				p += 1
			print(p * s1)


n = int(input())
s = input()
if len(s) % n != 0:
	print(('1' + '0' * (n - 1)) * (len(s) // n + 1))
else:
	r = s[:n]
	t = len(s) // n
	if r * t > s:
		print(r * t)
	elif any((x in r for x in '012345678')):
		print(str(int(r) + 1) * t)
	else:
		print(('1' + '0' * (n - 1)) * (t + 1))


l = int(input())
a = input()
lena = len(a)
if lena % l != 0:
	ans = '1' + '0' * (l - 1)
	ans = ans * (lena // l + 1)
	print(ans)
else:
	seg = lena // l
	now = a[0:l]
	flag = 0
	for i in range(seg):
		if now > a[i * l:(i + 1) * l]:
			flag = 1
			break
		elif now < a[i * l:(i + 1) * l]:
			break
	if flag == 0:
		if now.count('9') == l:
			now = '1' + '0' * (l - 1)
			seg += 1
		else:
			now = str(int(now) + 1)
	print(now * seg)


n = int(input())
s = input()
k = len(s)
if k % n != 0 or s == '9' * k:
	print(('1' + (n - 1) * '0') * (k // n + 1))
else:
	s1 = s[:n] * (k // n)
	for i in range(k):
		if int(s1[i]) < int(s[i]):
			s2 = ''
			c = 1
			for i in range(n - 1, -1, -1):
				s2 += str((int(s[i]) + c) % 10)
				c = (int(s[i]) + c) // 10
			print(s2[::-1] * (k // n))
			break
		elif int(s1[i]) > int(s[i]):
			print(s1)
			break
		elif i == k - 1:
			s2 = ''
			c = 1
			for i in range(n - 1, -1, -1):
				s2 += str((int(s[i]) + c) % 10)
				c = (int(s[i]) + c) // 10
			print(s2[::-1] * (k // n))
			break


L = int(input())
A = input()
n = len(A)
if L > n:
	print('1' + '0' * (L - 1))
	exit()
if n % L != 0:
	repeat = (n + (L - 1)) // L
	print(('1' + '0' * (L - 1)) * repeat)
	exit()
separate = [A[i:i + L] for i in range(0, n, L)]
separate_set = set(separate)
if len(separate_set) == 1:
	if separate[0] == '9' * L:
		repeat = n // L + 1
		print(('1' + '0' * (L - 1)) * repeat)
	else:
		repeat_part = str(int(separate[0]) + 1)
		print(repeat_part * (n // L))
else:
	first = separate[0]
	for i in range(1, len(separate)):
		if separate[i] != first:
			second = separate[i]
	if int(first) > int(second):
		print(first * (n // L))
	else:
		repeat_part = str(int(separate[0]) + 1)
		print(repeat_part * (n // L))


n = int(input())
s = input()
s = str(int(s) + 1)
l = len(s)
if n == l:
	print(s)
elif n > l:
	print(str('1' + '0' * (n - 1)))
elif l % n != 0:
	print(str('1' + '0' * (n - 1)) * (l // n + 1))
else:
	d = s[:n]
	i = n
	flag = 0
	while i < l:
		z = s[i:i + n]
		if int(z) > int(d):
			d = str(int(d) + 1)
			flag = 1
			break
		i = i + n
	print(str(d) * int(l // n))


from sys import setcheckinterval, stdin, setrecursionlimit
setcheckinterval(1000)
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))
l = iin()
a = list(input())
n = len(a)
if n < l:
	print('1' + '0' * (l - 1))
elif l == n:
	for i in range(l - 1, -1, -1):
		chg = int(a[i])
		if chg < 9:
			a[i] = str(chg + 1)
			break
		else:
			a[i] = '0'
	else:
		s1 = '1' + '0' * (l - 1)
		s2 = s1 * 2
		print(s2)
		return
	print(*a, sep='')
elif n % l == 0:
	x = n // l
	s1 = a[:l]
	s2 = s1 * x
	if s2 <= a:
		for i in range(l):
			chg = int(s1[-i - 1])
			if chg < 9:
				s1[-i - 1] = str(chg + 1)
				break
			else:
				s1[-i - 1] = '0'
		else:
			s1 = '1' + '0' * (l - 1)
			s2 = s1 * (x + 1)
			print(s2)
			return
		s2 = s1 * x
	print(*s2, sep='')
else:
	x = (n + l - 1) // l
	s1 = '1' + '0' * (l - 1)
	s2 = s1 * x
	print(s2)


def checks(s, k):
	tt = -1
	ans = 0
	d = set()
	for i in range(len(s) // k):
		d.add(s[i * k:(i + 1) * k])
		if int(s[i * k:(i + 1) * k]) > tt:
			tt = int(s[i * k:(i + 1) * k])
			ans = i
	if ans == 0 and len(d) != 1:
		return s[0:k]
	else:
		return str(int(s[0:k]) + 1)
import math
k = int(input())
s = input()
ans = 0
anss = ''
if len(s) % k == 0 and s.count('9') != len(s):
	if len(s) == k:
		kk = int(s)
		print(kk + 1)
	else:
		print(checks(s, k) * (len(s) // k))
else:
	anss = '1' + '0' * (k - 1)
	print(anss * (1 + len(s) // k))


def plus1(str1):
	return str(int(str1) + 1)
L = int(input())
S = input()
Len = len(S)
if Len % L != 0:
	base = '1' + '0' * (L - 1)
	x = int(Len // L) + 1
	print(base * x)
elif S.count('9') == Len:
	base = '1' + '0' * (L - 1)
	x = int(Len // L) + 1
	print(base * x)
else:
	x = int(Len // L)
	if S[:L] * x > S:
		print(S[:L] * x)
	else:
		base = plus1(S[:L])
		print(base * x)


l = int(input())
a = input()
la = len(a)
if la % l != 0:
	per = la // l + 1
	ans = '1' + '0' * (l - 1)
	ans *= per
	print(ans)
else:
	ans = a[:l]
	per = la // l
	if ans * per > a:
		print(ans * per)
	else:
		temp = str(int(ans) + 1)
		if len(temp) == l:
			print(temp * per)
		else:
			temp = '1' + '0' * (l - 1)
			temp *= per + 1
			print(temp)


import os
import sys
import textwrap

def solve():
	L = int(input())
	A = input()
	size = len(A)
	div = int(size / L)
	mod = size % L
	if size == L:
		if A == '9' * L:
			print(str(10 ** (L - 1)) * (div + 1))
		else:
			print(int(A) + 1)
	elif mod:
		print(str(10 ** (L - 1)) * (div + 1))
	else:
		parts = [int(x) for x in textwrap.wrap(A, L)]
		rep = parts[0]
		if rep == 10 ** L - 1:
			print(str(10 ** (L - 1)) * (div + 1))
		elif rep > parts[1]:
			print(str(rep) * div)
		elif rep < parts[1]:
			print(str(rep + 1) * div)
		else:
			index = 2
			pl = len(parts)
			while index < pl and rep == parts[index]:
				index += 1
			if index == pl or parts[index] >= rep:
				print(str(rep + 1) * div)
			else:
				print(str(rep) * div)
if 'PYCHARM_HOSTED' in os.environ:
	sys.stdin = open('input.in')
solve()


import math
L = int(input())
A = input()
len_A = len(A)
if len_A % L != 0:
	print(('1' + '0' * (L - 1)) * math.ceil(len_A / L))
else:
	p = A[:L]
	intp = p * int(len_A / L)
	if intp > A:
		print(intp)
	elif p.count('9') == L:
		print(('1' + '0' * (L - 1)) * (int(len_A / L) + 1))
	else:
		print(str(int(p) + 1) * int(len_A / L))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
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')

class SegmentTree:

	def __init__(self, data, default=10 ** 10, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
n = int(input())
s = input()
if len(s) % n != 0:
	print(('1' + '0' * (n - 1)) * (len(s) // n + 1))
else:
	r = s[:n]
	t = len(s) // n
	if r * t > s:
		print(r * t)
	elif any((x in r for x in '012345678')):
		print(str(int(r) + 1) * t)
	else:
		print(('1' + '0' * (n - 1)) * (t + 1))


import sys, math, statistics as ss, collections as cc
input = sys.stdin.readline
n = int(input())
a = input()
a = a[:len(a) - 1]
if len(a) % n == 0:
	q = a[:n] * (len(a) // n)
	if q > a:
		print(q)
	elif a[:n].count('9') == n:
		print(''.join((['1'] + ['0' * (n - 1)]) * ((len(a) + n) // n)))
	else:
		print(str(int(a[:n]) + 1) * (len(a) // n))
else:
	print(''.join((['1'] + ['0' * (n - 1)]) * math.ceil(len(a) / n)))


L = int(input())
A = int(input())
l1 = []
D = A
s1 = str(D)
q = len(s1) // L
q1 = q + 1
if len(s1) % L != 0:
	print(('1' + '0' * (L - 1)) * q1)
else:
	s = ''
	if L == len(s1):
		print(A + 1)
	elif int(s1[0]) < int(s1[L]):
		v = s1[0:L]
		s += v[0:len(v) - 1]
		s += str(int(v[-1]) + 1)
		print(s * q)
	else:
		l2 = []
		ind = 0
		for m in range(q):
			l2.append(int(s1[ind:ind + L]))
			ind = ind + L
		c = l2[0]
		val = 0
		for j in l2:
			if j > c:
				c += 1
				break
			elif j == c:
				val += 1
		if val == len(l2):
			d = c + 1
			d = str(d)
			if len(str(d)) > len(str(c)):
				c = d[0:len(d) - 1]
				q += 1
			else:
				c = str(d)
		print(str(c) * q)


import sys
input = sys.stdin.buffer.readline

def process(S, L):
	n = len(S)
	if n % L != 0:
		a = n // L
		a2 = (a + 1) * L
		answer = []
		for i in range(a2):
			if i % L == 0:
				answer.append('1')
			else:
				answer.append('0')
		answer = ''.join(answer)
		return answer
	else:
		need_larger = False
		is_equal = True
		for i in range(n):
			if S[i % L] != S[i]:
				is_equal = False
				if S[i % L] < S[i]:
					need_larger = True
				else:
					need_larger = False
				break
		a = int(S[:L])
		if need_larger or is_equal:
			a += 1
		a = str(a)
		if len(a) == L:
			answer = [a[i % L] for i in range(n)]
			answer = ''.join(answer)
			return answer
		else:
			a2 = (n // L + 1) * L
			answer = []
			for i in range(a2):
				if i % L == 0:
					answer.append('1')
				else:
					answer.append('0')
			answer = ''.join(answer)
			return answer
L = int(input())
S = input()[:-2]
sys.stdout.write(process(S, L))


L = int(input())
A = input()
N = len(A)
if N % L != 0 or A == '9' * N:
	K = N // L + 1
	for _ in range(K):
		print(1, end='')
		for _ in range(L - 1):
			print(0, end='')
	print()
else:
	for k in range(N // L):
		lg = 0
		for l in range(L):
			a0 = int(A[l])
			a = int(A[k * L + l])
			if a > a0:
				lg = 1
				break
			if a < a0:
				lg = -1
				break
		if lg == -1 or lg == 1:
			break
	if lg == -1:
		for _ in range(N // L):
			print(A[:L], end='')
		print()
	elif lg == 1 or lg == 0:
		B = list(A[:L])
		for l in range(L):
			b = int(B[L - 1 - l]) + 1
			if b == 10:
				B[L - 1 - l] = '0'
			else:
				B[L - 1 - l] = str(b)
				break
		for _ in range(N // L):
			print(''.join(B), end='')
		print()


from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
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 = read(self._fd, max(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, size: int=...):
		while self.newlines == 0:
			b = read(self._fd, max(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:
			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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')
import math
l = int(input())
a = str(input())
n = len(a)
m = math.ceil(n / l)
if n % l != 0:
	s = '1' + '0' * (l - 1)
	r = s * m
	print(r)
else:
	s = a[0:l]
	r = int(s * m)
	if r > int(a):
		print(r)
	elif a == '9' * n:
		s = '1' + '0' * (l - 1)
		r = s * (m + 1)
		print(r)
	else:
		s = str(int(a[0:l]) + 1)
		r = s * m
		print(r)


l = int(input())
s = input()
s = list(s)
if len(s) % l != 0 or len(s) < l:
	for i in range(len(s) // l + 1):
		print('1', end='')
		for j in range(l - 1):
			print('0', end='')
else:
	isPossible = False
	for i in range(l, len(s)):
		if int(s[i]) < int(s[i % l]):
			isPossible = True
			break
		elif s[i] != s[i % l]:
			break
	if isPossible:
		for i in range(len(s) // l):
			for j in range(l):
				print(s[j], end='')
	else:
		exceptNine = False
		pos = -1
		for i in range(l - 1, -1, -1):
			if s[i] != '9':
				exceptNine = True
				s[i] = str(int(s[i]) + 1)
				pos = i + 1
				break
		if exceptNine:
			for i in range(pos, l):
				s[i] = '0'
			for i in range(len(s) // l):
				for j in range(l):
					print(s[j], end='')
		else:
			for i in range(len(s) // l + 1):
				print('1', end='')
				for j in range(l - 1):
					print('0', end='')


import os
import sys
from io import BytesIO, IOBase

def main():
	l = int(input())
	a = list(map(int, input().rstrip()))
	n = len(a)
	if n % l:
		print(('1' + '0' * (l - 1)) * (n // l + 1))
	else:
		z = a[:l] * (n // l)
		if z > a:
			print(''.join(map(str, z)))
		elif a[:l] == [9] * l:
			print(('1' + '0' * (l - 1)) * (n // l + 1))
		else:
			(b, c) = ([], 1)
			for i in range(l - 1, -1, -1):
				b.append((a[i] + c) % 10)
				c = (a[i] + c) // 10
			if c:
				b.append(c)
			b.reverse()
			print(*b * (n // l), sep='')
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')
main()


L = int(input())
str_A = input()
lens = len(str_A)
if lens % L == 0 and str_A != '9' * lens:
	build = -1
	for i in range(L, lens):
		if str_A[i] < str_A[i % L]:
			build = 0
			break
		elif str_A[i] > str_A[i % L]:
			build = 1
			break
	if build in (1, -1):
		print(str(int(str_A[:L]) + 1) * (lens // L))
	if build == 0:
		print(str_A[:L] * (lens // L))
else:
	perf = ('1' + '0' * (L - 1)) * (lens // L + 1)
	print(perf)


import math as m

def main():
	n = int(input())
	s = input()
	l = len(s)
	p = int(m.ceil(l / n))
	if l % n != 0:
		t = '1'
		for i in range(1, n):
			t += '0'
		for i in range(0, p):
			print(t, end='')
	else:
		z = s[0:n]
		t = ''
		for i in range(0, p):
			t += z
		if t > s:
			print(t)
			return
		z = str(int(s[0:n]) + 1)
		if len(z) > n:
			t = '1'
			for i in range(1, n):
				t += '0'
			for i in range(0, p + 1):
				print(t, end='')
			return
		t = ''
		for i in range(0, p):
			t += z
		print(t)
main()


import math
n = int(input())
s = input()
if n > len(s):
	print('1' + '0' * (n - 1))
elif len(s) % n != 0:
	cnt = math.ceil(len(s) / n)
	res = '1' + '0' * (n - 1)
	print(res * cnt)
else:
	val = len(s) // n
	if len(set(s)) == 1 and s[0] == '9':
		print(('1' + '0' * (n - 1)) * (val + 1))
	else:
		res1 = s[0:n] * val
		if res1 > s:
			print(res1)
		else:
			res2 = str(int(s[0:n]) + 1) * val
			print(res2)


import sys, math
readline = sys.stdin.readline
l = int(input())
n = readline().split()[0]
if len(n) % l:
	print(('1' + '0' * (l - 1)) * (len(n) // l + 1))
else:
	ans = str(n[:l]) * (len(n) // l)
	for i in range(len(n) // l):
		tp = int(n[l * i:(1 + i) * l])
		if tp > int(n[:l]):
			ans = str(int(n[:l]) + 1) * (len(n) // l)
			break
	if ans == n:
		ans = str(int(n[:l]) + 1) * (len(n) // l)
		if len(ans) > len(n):
			ans = ('1' + '0' * (l - 1)) * (len(n) // l + 1)
		print(ans)
	else:
		print(ans)


L = int(input())
string = input()
q = len(string) // L
r = len(string) % L
if q == 0:
	temp = '1' + '0' * (L - 1)
	ans = temp
elif r != 0:
	temp = '1' + '0' * (L - 1)
	ans = temp * (q + 1)
else:
	temp = string[0:L]
	temp2 = temp * q
	if int(temp2) > int(string):
		ans = temp2
	elif temp == '9' * L:
		temp = '1' + '0' * (L - 1)
		temp = temp * (q + 1)
		ans = temp
	else:
		temp2 = int(temp) + 1
		ans = str(temp2) * q
print(ans)


def main():
	l = int(input())
	s = input()
	n = len(s)
	if l > n or n % l != 0:
		k = '1' + '0' * (l - 1)
		c = (n + l - 1) // l
		print(k * c)
	else:
		k = s[:l]
		p = k * (n // l)
		if p > s:
			print(p)
		else:
			p = str(int(k) + 1)
			if len(p) == len(k):
				print(p * (n // l))
			else:
				n += 1
				k = '1' + '0' * (l - 1)
				c = (n + l - 1) // l
				print(k * c)
	return

def __starting_point():
	main()
__starting_point()


def revive(l):
	res = pow(10, l - 1)
	return str(res)
l = int(input())
s = input()
val = 0
if len(s) % l == 0:
	ans = s[:l]
	if ans * (len(s) // l) > s:
		print(ans * (len(s) // l))
		return
	elif ans == '9' * l:
		ans = revive(l)
		val = l
	else:
		ans = str(int(ans) + 1)
else:
	ans = revive(l)
print(ans * ((len(s) + l - 1 + val) // l))


l = int(input())
xs = input()

def run():
	if len(xs) % l != 0:
		d = len(xs) // l + 1
		ans = ('1' + '0' * (l - 1)) * d
		return ans
	d = len(xs) // l
	prf = xs[:l]
	tl = prf * d
	if tl > xs:
		return tl
	if prf == '9' * l:
		return ('1' + '0' * (l - 1)) * (d + 1)
	return str(int(prf) + 1) * d
print(run())


import sys

def add_one(p):
	count = 0
	for i in range(len(p) - 1, -1, -1):
		if p[i] == '9':
			count += 1
		else:
			return (p[:-1 - count] + str(int(p[i]) + 1) + '0' * count, 0)
	return ('0' * count, 1)
L = int(input())
A = input()
if len(A) % L == 0:
	p_size = int(len(A) / L)
	p = A[:L]
	for i in range(2, p_size + 1):
		num = A[(i - 1) * L:i * L]
		if p > num:
			print(A[:L] * p_size)
			sys.exit(0)
		elif p < num:
			(p, _) = add_one(p)
			print(p * p_size)
			sys.exit(0)
	(p, c) = add_one(p)
	if c == 1:
		print(('1' + '0' * (L - 1)) * (p_size + 1))
	else:
		print(p * p_size)
else:
	print(('1' + '0' * (L - 1)) * (int(len(A) / L) + 1))


def main():
	L = int(input())
	s = input()
	n = len(s)
	q = 1 + n // L
	base = s[:L]
	if n % L != 0 or L > n or base == '9' * L:
		print(('1' + '0' * (L - 1)) * q)
		return
	q -= 1
	for i in range(1, q):
		cur = s[L * i:L * (i + 1)]
		if cur < base:
			print(base * q)
			return
	carry = 1
	ret = ''
	for i in range(L - 1, -1, -1):
		cur = int(base[i]) + carry
		if cur == 10:
			cur = 0
			carry = 1
		else:
			carry = 0
		ret += str(cur)
	print(ret[::-1] * q)
main()


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')
import math

def simpans(l, length):
	a1 = ['0' for s in range(l)]
	a1[0] = '1'
	ans = []
	for s in range(length):
		for b in range(l):
			ans += a1[b]
	print(''.join(ans))
l = int(input())
a = input()
n = len(a)
length = math.ceil(n / l)
if n % l != 0:
	simpans(l, length)
else:
	a0 = [k for k in a]
	found = False
	ind = -1
	for s in range(l - 1, -1, -1):
		if int(a0[s]) < 9:
			found = True
			ind = s
			break
	if l == n:
		if found == True:
			a0[ind] = str(int(a0[ind]) + 1)
			for s in range(ind + 1, l):
				a0[s] = '0'
			print(''.join(a0))
		else:
			simpans(l, length + 1)
	elif found == True:
		a1 = []
		ans = []
		for s in range(l):
			a1.append(a0[s])
		for s in range(length):
			for b in range(l):
				ans += a1[b]
		if int(''.join(ans)) <= int(a):
			a1 = []
			ans = []
			for s in range(l):
				a1.append(a0[s])
			a1[ind] = str(int(a1[ind]) + 1)
			for s in range(ind + 1, l):
				a1[s] = '0'
			for s in range(length):
				for b in range(l):
					ans += a1[b]
			print(''.join(ans))
		else:
			print(''.join(ans))
	else:
		simpans(l, length + 1)


L = int(input())
string = input()
length = len(string)
if length % L != 0:
	print(('1' + '0' * (L - 1)) * ((length + L - 1) // L))
else:
	uptoL = string[:L]
	periodic = uptoL * (length // L)
	if periodic > string:
		print(periodic)
	elif uptoL.count('9') == L:
		print(('1' + '0' * (L - 1)) * ((length + L) // L))
	else:
		print(str(int(uptoL) + 1) * (length // L))


import os
import sys

def split(line, n):
	return [line[i:i + n] for i in range(0, len(line), n)]

def solve(A, L):
	n_digit = len(A)
	(d, r) = divmod(n_digit, L)
	if r > 0 or A == '9' * len(A):
		return ('1' + '0' * (L - 1)) * (d + 1)
	chunks = split(A, L)
	y = chunks[0]
	for x in chunks[1:]:
		if y == x:
			continue
		if y < x:
			y = str(int(chunks[0]) + 1)
		break
	else:
		y = str(int(chunks[0]) + 1)
	return y * d

def pp(input):
	L = int(input().strip())
	A = input().strip()
	print(solve(A, L))
if 'pydev' in sys.argv[0]:
	from string_source import string_source, codeforces_parse
	x = 'inputCopy\n3\n123456\noutputCopy\n124124\ninputCopy\n3\n12345\noutputCopy\n100100'
	for (q, a) in codeforces_parse(x):
		pp(string_source(q))
		print('EXPECTED')
		print(a)
		print('----')
else:
	pp(sys.stdin.readline)


import sys
input = sys.stdin.readline
l = int(input())
s = input().strip()
n = len(s)
if l > n:
	print(str('1' + '0' * (l - 1)))
elif n % l != 0:
	print(str('1' + '0' * (l - 1)) * (n // l + 1))
else:
	a = s[:l]
	b = str(int(s[:l]) + 1)
	g = 0
	for i in range(0, n, l):
		if a < s[i:i + l]:
			g = 1
			break
	if a <= s[n - l:n]:
		g = 1
	if g:
		if a == '9' * l:
			print(str('1' + '0' * (l - 1)) * (n // l + 1))
		else:
			print(b * (n // l))
	else:
		print(a * (n // l))


import io, sys, atexit, os
import math as ma
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

def li():
	return list(map(int, sys.stdin.readline().split()))

def num():
	return map(int, sys.stdin.readline().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg

def findSum(str1, str2):
	if len(str1) > len(str2):
		t = str1
		str1 = str2
		str2 = t
	str = ''
	n1 = len(str1)
	n2 = len(str2)
	str1 = str1[::-1]
	str2 = str2[::-1]
	carry = 0
	for i in range(n1):
		sum = ord(str1[i]) - 48 + (ord(str2[i]) - 48 + carry)
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	for i in range(n1, n2):
		sum = ord(str2[i]) - 48 + carry
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	if carry:
		str += chr(carry + 48)
	str = str[::-1]
	return str
mm = 1000000007

def solve():
	t = 1
	for tt in range(t):
		n = nu()
		s = input()
		if len(s) % n != 0:
			nm = len(s) // n + 1
			hp = '1'
			for i in range(n - 1):
				hp += '0'
			op = ''
			for i in range(nm):
				op += hp
			print(op)
			continue
		ff = s[0:n]
		ox = s[n:]
		vv = ''
		for i in range(len(s)):
			vv += '9'
		if vv == s:
			nm = len(s) // n + 1
			hp = '1'
			for i in range(n - 1):
				hp += '0'
			op = ''
			for i in range(nm):
				op += hp
			print(op)
			continue
		gp = ''
		last = -1
		ok = -1
		for i in range(0, len(ox), n):
			for j in range(i, i + n):
				if ff[j - i] < ox[j]:
					last = 1
					break
				if ff[j - i] > ox[j]:
					ok = j + 1
					break
			if last != -1:
				break
			if ok != -1:
				break
		ans = ''
		if last != -1:
			gp = findSum(ff, '1')
			for i in range(len(s) // n):
				print(gp, end='')
			continue
		if ok != -1:
			for i in range(len(s) // n):
				print(ff, end='')
			continue
		gp = findSum(ff, '1')
		for i in range(len(s) // n):
			print(gp, end='')

def __starting_point():
	solve()
__starting_point()


import sys
l = int(sys.stdin.readline())
s = sys.stdin.readline()[:-1]

def check(s):
	n = len(s)
	for i in range(n):
		if s[i] != '9':
			return False
	return True
n = len(s)
if n % l != 0:
	ans = ['0' for _ in range(l)]
	ans[0] = '1'
	x = ['0' for _ in range(l * (n // l + 1))]
	i = 0
	while i < (n // l + 1) * l:
		for j in range(l):
			x[i] = ans[j]
			i += 1
	print(''.join((y for y in x)))
else:
	j = l - 1
	carry = 1
	s_ind = ''
	for i in range(l - 1, -1, -1):
		y = (int(s[i]) + carry) % 10
		carry = (int(s[i]) + carry) // 10
		if carry == 0:
			s_ind = str(y)
			break
	if carry:
		if check(s):
			ans = ['0' for _ in range(l)]
			ans[0] = '1'
			i = 0
			x = ['0' for _ in range(l * (n // l + 1))]
			while i < (n // l + 1) * l:
				for j in range(l):
					x[i] = ans[j]
					i += 1
		else:
			x = ['9' for _ in range(l * (n // l + 1))]
		print(''.join((y for y in x)))
	else:
		ans = ['0' for _ in range(l)]
		ans[i] = str(y)
		for j in range(i):
			ans[j] = s[j]
		for j in range(i + 1, l):
			ans[j] = '0'
		x = ['0' for _ in range(n)]
		i = 0
		while i < n // l * l:
			for j in range(l):
				x[i] = ans[j]
				i += 1
		b = s[:l] * (n // l)
		a = ''.join((y for y in x))
		if a < b:
			print(a)
		elif b > s:
			print(b)
		else:
			print(a)


import math
l = int(input())
a = str(input())
n = len(a)
m = math.ceil(n / l)
if n % l != 0:
	s = '1' + '0' * (l - 1)
	r = s * m
	print(r)
else:
	s = a[0:l]
	r = int(s * m)
	if r > int(a):
		print(r)
	elif a == '9' * n:
		s = '1' + '0' * (l - 1)
		r = s * (m + 1)
		print(r)
	else:
		s = str(int(a[0:l]) + 1)
		r = s * m
		print(r)


n = int(input())
str = input()
count = 0
a = [-1 for i in range(n)]
flag = 3
count = 0
store = 0
for i in str:
	if a[count % n] == -1:
		a[count % n] = int(i)
	elif a[count % n] == int(i) and flag == 2:
		flag = 3
	elif a[count % n] < int(i) and (flag == 2 or flag == 3):
		flag = -1
	elif a[count % n] > int(i) and (flag == 2 or flag == 3):
		flag = -2
		store = count % n
	count += 1
if flag == 3:
	flag = -1
d = count // n
if count % n != 0:
	d = (count + (n - count % n) % n) // n
	a = [0 for i in range(n)]
	a[0] = 1
	flag = 100
if flag == -1:
	i = n - 1
	while i >= 0:
		if a[i] != 9:
			a[i] += 1
			flag = 5
			break
		else:
			a[i] = 0
		i -= 1
if flag == -1:
	d = count // n + 1
	a = [0 for i in range(n)]
	a[0] = 1
if flag == -2:
	for i in range(count + 1, n):
		a[i] = 0
for i in range(n * d):
	print(a[i % n], end='')


n = int(input())
A = input()
L = len(A)

def check_increase(p_numb, n):
	if p_numb.count('9') == n:
		return True
	return False

def large_print(L, n):
	cycle_count = L // n + 1
	p_numb = '1' + '0' * (n - 1)
	print(p_numb * cycle_count)
if L == n:
	if check_increase(A[:n], n):
		large_print(L, n)
	else:
		print(int(A) + 1)
elif L % n == 0:
	p_numb = A[:n]
	for i in range(n, L):
		if int(p_numb[i % n]) > int(A[i]):
			break
		elif int(p_numb[i % n]) < int(A[i]):
			p_numb = str(int(p_numb) + 1)
			break
	else:
		p_numb = str(int(p_numb) + 1)
	if len(p_numb) == n:
		print(p_numb * (L // n))
	else:
		large_print(L, n)
else:
	large_print(L, n)


L = int(input())
A = input()
if len(A) % L == 0 and A != len(A) * '9':
	period = A[0:L]
	if period * (len(A) // L) <= A:
		period = str(int(period) + 1)
	print(period * (len(A) // L))
else:
	print(('1' + '0' * (L - 1)) * (len(A) // L + 1))


k = int(input())
s = input()
n = len(s)
if n % k != 0:
	ans = '1' + '0' * (k - 1)
	ans = ans * (n // k + 1)
	print(ans)
else:
	sf = s[0:k]
	if s == '9' * n:
		ans = ('1' + '0' * (k - 1)) * (n // k + 1)
	else:
		f = 0
		g = 0
		for i in range(n // k):
			s1 = s[i * k:(i + 1) * k]
			if s1 < sf and g == 0:
				f = 1
			if s1 > sf:
				g = 1
		if f == 1:
			ans = str(sf) * (n // k)
		else:
			ans = str(int(sf) + 1) * (n // k)
	print(ans)


L = int(input())
A = input()
if len(A) < L:
	print('1' + '0' * (L - 1))
elif len(A) % L == 0:
	B = A[0:L]
	if B * (len(A) // L) > A:
		print(B * (len(A) // L))
	elif B.count('9') == L:
		print(('1' + '0' * (L - 1)) * (len(A) // L + 1))
	else:
		i = L - 1
		while B[i] == '9':
			i -= 1
		B = B[0:i] + str(int(B[i]) + 1)
		B += '0' * (L - len(B))
		print(B * (len(A) // L))
else:
	print(('1' + '0' * (L - 1)) * (len(A) // L + 1))


import sys
l = int(input())
s = input()
n = len(s)

def f():
	req = (n + l - 1) // l
	req_s = '1' + '0' * (l - 1)
	print(req_s * req)
	sys.exit()
if n % l != 0:
	f()
else:
	if s.count('9') == n:
		n += l
		f()
	req = n // l
	test = s[0:l] * req
	if test > s:
		print(test)
		sys.exit()
	i = l - 1
	nine = 0
	while i >= 0 and s[i] == '9':
		i -= 1
		nine += 1
	print((s[0:i] + str(int(s[i]) + 1) + '0' * nine) * req)


def isAll9s(s):
	return set(s) == {'9'}

def add1(s):
	n = len(s)
	arr = [int(x) for x in s]
	for i in range(n - 1, -1, -1):
		if arr[i] == 9:
			arr[i] = 0
		else:
			arr[i] += 1
			break
	return ''.join([str(x) for x in arr])

def main():
	L = int(input())
	A = input()
	n = len(A)
	if L > n:
		ans = '1' + '0' * (L - 1)
	elif n % L == 0 and isAll9s(A) == False:
		m = n // L
		firstL = A[:L]
		ans = m * firstL
		if ans <= A:
			firstL2 = add1(firstL)
			ans = firstL2 * m
	else:
		finalLen = n + L
		ans = ('1' + '0' * (L - 1)) * (finalLen // L)
	print(ans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(i, j):
	print('? {} {}'.format(i, j))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(' '.join([str(x) for x in ans])))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


def main():
	L = int(input())
	A = input()
	n = len(A)
	if L > n:
		print('1' + '0' * (L - 1))
	elif L == n:
		ia1 = int(A) + 1
		if ia1 == 10 ** n:
			repeat = '1' + '0' * (L - 1)
			print(repeat * 2)
		else:
			print(ia1)
	elif n % L == 0:
		ia1 = int(A) + 1
		if ia1 == 10 ** n:
			repeat = '1' + '0' * (L - 1)
			print(repeat * (n // L + 1))
		else:
			prefix = int(A[:L])
			if prefix <= int(A[-L:]):
				repeat = prefix + 1
			else:
				repeat = prefix
			print(str(repeat) * (n // L))
	else:
		repeat = '1' + '0' * (L - 1)
		print(repeat * (n // L + 1))
main()


import math, sys

def check(m):
	for i in range(len(m)):
		if m[i] != '9':
			return False
	return True
n = int(input())
s = input()
if len(s) % n != 0:
	sys.stdout.write(str(10 ** (n - 1)) * math.ceil(len(s) / n))
else:
	m = -1
	if check(str(s)):
		sys.stdout.write(str(10 ** (n - 1)) * math.ceil((len(s) + 1) / n))
		sys.exit()
	for i in range(len(s) // n):
		if m == -1:
			m = int(s[n * i:n * i + n])
		else:
			m = min(m, int(s[n * i:n * i + n]))
	if m != int(s[:n]):
		sys.stdout.write(s[:n] * (len(s) // n))
	else:
		sys.stdout.write(str(int(s[:n]) + 1) * (len(s) // n))


import math
l = int(input())
a = input()
l_a = len(a)
if l_a % l != 0:
	l_in_P = int(l_a / l) + 1
	i = 0
	P = 10 ** (l - 1)
	P = str(P)
	amount = 0
	while i < l_in_P:
		print(P, end='')
		i = i + 1
else:
	l_in_P = int(l_a / l)
	a_str = a
	int_for_P = a_str[0:l]
	compare = '='
	i = 0
	while i < l_in_P:
		index = l * i
		difference = int(a_str[index:index + l]) - int(int_for_P)
		if difference != 0:
			if difference < 0:
				compare = '<'
			else:
				compare = '>'
			break
		i = i + 1
	if compare == '<':
		i = 0
		while i < l_in_P:
			print(int_for_P, end='')
			i = i + 1
	elif int_for_P != '9' * l:
		P = int_for_P
		k = l - 1
		while P[k] == '9':
			k = k - 1
		P = P[0:k] + str(int(P[k]) + 1) + '0' * (l - k - 1)
		i = 0
		while i < l_in_P:
			print(P, end='')
			i = i + 1
	else:
		P = '1' + '0' * (l - 1)
		l_in_P = l_in_P + 1
		i = 0
		while i < l_in_P:
			print(P, end='')
			i = i + 1


l = int(input())
n = input()
if l == len(n):
	print(int(n) + 1)
elif len(n) % l == 0:
	x = int(n[0:l])
	m = str(x) * (len(n) // l)
	if m > n:
		print(m)
	elif m <= n:
		o = len(str(x))
		x += 1
		if len(str(x)) - o == 0:
			m = str(x) * (len(n) // l)
			print(m)
		else:
			x = '1' + '0' * (l - 1)
			a = len(n) + (l - len(n) % l)
			x = x * (a // l)
			print(x)
else:
	x = '1' + '0' * (l - 1)
	a = len(n) + (l - len(n) % l)
	x = x * (a // l)
	print(x)


import math
L = int(input())
A = input()
f = int(''.join(A[:L]))
tn = False
if (1 - abs(math.log(f + 1) / math.log(10) % 1)) % 1 < 10 ** (-9):
	tn = True
if len(A) % L != 0:
	ln = len(A) + (L - len(A) % L)
	num = ('1' + '0' * (L - 1)) * (ln // L)
	print(num)
else:
	f = int(''.join(A[:L]))
	fn = False
	ft = True
	for i in range(L, len(A), L):
		if int(''.join(A[i:i + L])) > f and (not fn):
			ft = False
		if int(''.join(A[i:i + L])) < f:
			fn = True
	if fn and ft:
		print(str(f) * (len(A) // L))
	elif tn:
		print(('1' + '0' * (L - 1)) * (len(A) // L + 1))
	else:
		print(str(f + 1) * (len(A) // L))