Harryxun/stf_run huggingface dataset:
N, M = map(int,input().split())

reslist = []

if M == 0:
    if N == 1:
        print(0)
        exit(0)
    else:
        print('1' + '0'*(N-1))
        exit(0)

slist = [list(map(int,input().split())) for i in range(M)]

mlist = [-1 for i in range (M+1)]

for lis in slist:
    if mlist[lis[0]] != -1:
        if mlist[lis[0]] != lis[1]:
            print(-1)
            exit(0)
    else:
        if lis[0] == 1 and lis[1] == 0:
            print(-1)
            exit(0)
        mlist[lis[0]] = lis[1]

# print(mlist)



for j in range(1, N+1):
    # print(mlist[j])
    if mlist[j] == -1:
        if j == 1:
            reslist.append(1)
        else:
            reslist.append(0)
    else:
        reslist.append(mlist[j])

# print(reslist)

print("".join(map(str,reslist)))

### FIXED CODE ###

N, M = map(int,input().split())

reslist = []

if M == 0:
    if N == 1:
        print(0)
        exit(0)
    else:
        print('1' + '0'*(N-1))
        exit(0)

slist = [list(map(int,input().split())) for i in range(M)]

mlist = [-1 for i in range (N+1)]

for lis in slist:
    if mlist[lis[0]] != -1:
        if mlist[lis[0]] != lis[1]:
            print(-1)
            exit(0)
    else:
        mlist[lis[0]] = lis[1]

# print(mlist)



for j in range(1, N+1):
    # print(mlist[j])
    if mlist[j] == 0 and N > 1 and j == 1:
        print(-1)
        exit(0)
    if mlist[j] == -1:
        if j == 1:
            reslist.append(1)
        else:
            reslist.append(0)
    else:
        reslist.append(mlist[j])

# print(reslist)

print("".join(map(str,reslist)))
n = int(input())

az = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

def norm(n, in_list):
	out_list = []
	for l in in_list:
		for i in range(len(set(l))+1):
			new_l = l + az[i]
      		out_list.append(new_l)
	return out_list

line = ["a"]

for _ in range(N-1):
  line = norm(1,line)
  
for l in line:
  print(l)


### FIXED CODE ###

N = int(input())
az = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def norm(n, in_list):
	out_list = []
	for line in in_list:
		for i in range(len(set(line))+1):
			new_line = line + az[i]
			out_list.append(new_line)
	return out_list
init_line = ['a']
for _ in range(N-1):
	init_line = norm(1, init_line)
for line in init_line:
	print(line)
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    lr = [list(map(int, input().rstrip('\n').split())) for _ in range(m)]
    a = [0] * (n + 2)
    for l, r in lr:
        a[l] += 1
        a[r + 1] -= 1
    t = 0
    cnt = 0
    for i in range(1, n + 1):
        t += a[i]
        if t == m:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()


### FIXED CODE ###

a, b = map(int, input().split())
if a * b <= 0:
    print("Zero")
elif a > 0 and b > 0:
    print("Positive")
else:
    if (abs(a - b) + 1) % 2 == 0 :
        print("Positive")
    else:
        print("Negative")
str = input()

split = str.split(" ")

Member = int(split[0])
Point = int(split[1])
Ans = int(split[2])
MemPoint = [0 for i in range(Member)]

for i in range(Ans):
  MemPoint[int(input())] += 1

maxNum = max(MemPoint)
for i in range(Menber):
  if maxNum == MemPoint[i]:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

str = input()

split = str.split(" ")

Member = int(split[0])
Point = int(split[1])
Ans = int(split[2])
MemPoint = [0 for i in range(Member)]

for i in range(Ans):
  MemPoint[int(input())-1] += 1

for i in range(Member):
  if Point - (Ans - MemPoint[i]) > 0:
    print("Yes")
  else:
    print("No")
a, b, c, d = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
ad = [al[i] - al[i-1] for i in range(1, len(al))]
ad.insert(0, 0)
ad.append(-(10**15))
bd = [bl[i] - bl[i-1] for i in range(1, len(al))]
bd.insert(0, 0)
bd.append(-(10**15))
cd = [cl[i] - cl[i-1] for i in range(1, len(al))]
cd.insert(0, 0)
cd.append(-(10**15))
q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
while True:
    q = sorted(q)
    score, aq, bq, cq = map(int, q.pop())
    if [score + ad[aq+1], aq+1, bq, cq] not in ans:
        q.append([score + ad[aq+1], aq+1, bq, cq])
        ans.append([score + ad[aq+1], aq+1, bq, cq])
    if [score + bd[bq+1], aq, bq+1, cq] not in ans:
        q.append([score + bd[bq+1], aq, bq+1, cq])
        ans.append([score + bd[bq+1], aq, bq+1, cq])
    if [score + cd[cq+1], aq, bq, cq+1] not in ans:
        q.append([score + cd[cq+1], aq, bq, cq+1])
        ans.append([score + cd[cq+1], aq, bq, cq+1])

    ans = sorted(ans, reverse=True)
    q = sorted(q, reverse=True)

    if len(ans) > d:
        if ans[d] > q[0]:
            break

ans = sorted(ans, reverse=True)
for i in range(d):
    print(ans[i][0])


### FIXED CODE ###

a, b, c, d = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
#while True:
for i in range(d):
    s, aq, bq, cq = map(int, q.pop())
    if len(al) > aq+1:
        if [al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq] not in ans:
            q.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])
            ans.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])

    if len(bl) > bq+1:
        if [al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq] not in ans:
            q.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])
            ans.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])

    if len(cl) > cq+1:
        if [al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1] not in ans:
            q.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])
            ans.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])

    q = sorted(q)

    #if len(ans) > d:
    #   ans = sorted(ans, reverse=True)
    #    if ans[d][0] > q[len(q)-1][0]:
    #        break

ans = sorted(ans, reverse=True)
for i in range(d):
    print(ans[i][0])
a = {int(s) for s in input().split()}
b = {int(s) for s in input().split()}

c = 0
for i in range(3):
  if a[i] == b[2-i]:
    c += 1
  else:
    print('NO')
    break
    
if c == 2:
	print('YES')
      


### FIXED CODE ###

from sys import stdin

a = list(input())
b = list(input())

def rot(a,b):
  if a[0] == b[2]:
    if a[1]==b[1]:
      if a[2]==b[0]:
        return 'YES'
  return 'NO'

print(rot(a,b))
N=int(input())
ls_S=list(input())
K=int(input())

for i in range(N-1):
    if ls_S[i]!=ls_S[K]:
        ls_S[i]="*"
for s in ls_S:
    print(s,end = "")
    


### FIXED CODE ###

N=int(input())
ls_S=list(input())
K=int(input())

for i in range(N):
    if ls_S[i]!=ls_S[K-1]:
        ls_S[i]="*"
for s in ls_S:
    print(s,end = "")
import os
import math
import itertools
import numpy as np

N=int(input())
A=np.zeros((8,2)).astype(int)
for i in range(N):
  temp=list(map(int, input().split()))
  A[i,0]=temp[0]
  A[i,1]=temp[1]


  
def distance(x1,y1,x2,y2):
  return math.sqrt((x1-x2)**2+(y1-y2)**2)



order=list(itertools.permutations(range(N)))

tab=np.zeros((N,N))
for i in range(N):
  for j in range(i+1,N):
    tab[i,j]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    tab[j,i]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    
ret=0
C=math.factorial(N)      
for i in range(C):
  o=order[i]
  for j in range(1,N):
    ret+=tab[o[j],o[j-1]]
print(ret/C)
    

### FIXED CODE ###

import os
import math
import itertools
import numpy as np

N=int(input())
A=np.zeros((8,2)).astype(int)
for i in range(N):
  temp=list(map(int, input().split()))
  A[i,0]=temp[0]
  A[i,1]=temp[1]


  
def distance(x1,y1,x2,y2):
  return math.sqrt((x1-x2)**2+(y1-y2)**2)



order=list(itertools.permutations(range(N)))

tab=np.zeros((N,N))
for i in range(N):
  for j in range(i+1,N):
    tab[i,j]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    tab[j,i]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    
ret=0
C=math.factorial(N)      
for i in range(C):
  o=order[i]
  for j in range(1,N):
    ret+=tab[o[j],o[j-1]]
print(ret/C)
import math
x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    c=int(math.factorial(a+b)/math.factorial(b)/math.factorial(a))
    print(c%(10**9+7))
  else:
    print(0)


### FIXED CODE ###

r=int(input())
print(r**2)
S = input()
T = input()
sum = 0
for i in range(len(S)):
  if S[i-1] <> T[i-1]:
    sum = sum + 1
print(sum)  

### FIXED CODE ###

S = input()
T = input()
sum = 0
for i in range(len(S)):
  if S[i-1] != T[i-1]:
    sum = sum + 1
print(sum)
import numpy as np

N, S, K = map(int, input().split())

target = S[K-1]

for i in range(N):
	if S[i]==target:
		arr+=target
	else:
		arr+=('*')

print(arr)



### FIXED CODE ###

N=int(input())
S=str(input())
K=int(input())
target = S[K-1]
arr = ''
 
for i in range(N):
	if S[i]==target:
		arr+=target
	else:
		arr+=('*')
 
print(arr)
# coding: utf-8
# Your code here!
A,V = int(input().split())
B,W = int(input().split())
T = int(input())

dis=abs(A-B)
dis1=(V-W)*T
if dis<=dis1:
    print("YES")
else:print("NO")


### FIXED CODE ###

# coding: utf-8
# Your code here!
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

dis=abs(A-B)
dis1=(V-W)*T

if dis<=dis1:
    print("YES")
else:
    print("NO")
n,k=input().split()
n=int(n)
k=int(k)

if n==k:
	print(1)
elif n//(k-1)=1:
	print(2)
else:
	print(n//(k-1))

### FIXED CODE ###

str=input()
list=list(str)
a=0
for i in range(4):
	if list[i]=="+":
		a=a+1
	else:
		a=a-1
print(a)
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]

ab_hash = {}
count = 0
price_sum = 0
for x in ab:
    ab_hash[x[0]] = x[1]
ab_key_sorted = sorted(ab_hash.items(), key=lambda x: x[0])
while M > 0:
    if M > ab_key_sorted[count][1]:
        price_sum += ab_key_sorted[count][0] * ab_key_sorted[count][1]
    else:
        price_sum += ab_key_sorted[count][0] * M
    M = M - ab_key_sorted[count][1]
    count += 1

print(price_sum)


### FIXED CODE ###

N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]

ab_hash = {}
count = 0
price_sum = 0
for x in range(len(ab)):
    ab_hash[x] = [ab[x][0], ab[x][1]]
ab_key_sorted = sorted(ab_hash.items(), key=lambda x: x[1][0])

for y in ab_key_sorted:
    if M > y[1][1]:
        price_sum += y[1][0] * y[1][1]
    else:
        price_sum += y[1][0] * M
    M -= y[1][1]
    if M <= 0:
        break

print(price_sum)
import random
r = random.randint(1,3)

if r == 1:
  # TLE
  import time
  time.sleep(5)
elif r == 2:
  # MLE
  x = '01234567'
  x *= (1 << 27)
else:
  # RE
  RE


### FIXED CODE ###

a,b = map(int,input().split())
if (a-b) % 2 == 0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')
import numpy as np

N,M = map(int,input().split())
Xs = sorted([int(i) for i in input().split()])

if N >= M:
    print(0)
else:
    margin = [Xs[i+1]-Xs[i] for i in range(len(Xs)-1)]
    margin = [(i,x) for i,x in enumerate(margin)]
    point = [x[0] for x in sorted(margin,key=lambda x:x[1],reverse=True)[:N-1]]
    move = 0
    move += Xs[point[0]] - Xs[0]
    for i in range(1,len(point)):
        move += Xs[point[i]] - Xs[point[i-1]+1]
    move += Xs[-1] - Xs[point[-1]+1]
    print(move)

### FIXED CODE ###

import numpy as np

N,M = map(int,input().split())
Xs = sorted([int(i) for i in input().split()])

if N >= M:
    print(0)
elif N == 1:
    print(Xs[-1]-Xs[0])
else:
    margin = [Xs[i+1]-Xs[i] for i in range(len(Xs)-1)]
    margin = [(i,x) for i,x in enumerate(margin)]
    point = [x[0] for x in sorted(margin,key=lambda x:x[1],reverse=True)[:N-1]]
    move = 0
    move += Xs[point[0]] - Xs[0]
    for i in range(1,len(point)):
        move += Xs[point[i]] - Xs[point[i-1]+1]
    move += Xs[-1] - Xs[point[-1]+1]
    print(move)
import bisect
from operator import itemgetter
import math
import copy
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = [i for i in S()]

ss = list(set(s))

if s.count(ss[0]) == s.count(ss[1]) and len(ss) == 2:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import bisect
from operator import itemgetter
import math
import copy
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = [i for i in S()]

ss = list(set(s))

if len(ss) == 1:
  print("No")
elif s.count(ss[0]) == s.count(ss[1]) and len(ss) == 2:
  print("Yes")
else:
  print("No")
from functools import reduce
mod = 10**9+7

def P(n, k):
  return reduce(lambda x, y:x*y%mod, range(n-k+1, n+1))

def factorial(n):
  return 1 if n == 0 else P(n, n)

X, Y = map(int, input().split())
L, S = max(X, Y), min(Y, X)
if (S-(L-S))%3 != 0:
  print(0)
else:
  s = (S-(L-S))//3
  l = (S-(L-S))//3+(L-S)
  bunshi = factorial(s+l)
  bunbo = (factorial(s)*factorial(l))%mod
  print((bunshi*pow(bunbo,mod-2, mod))%mod)
  
  

### FIXED CODE ###

from functools import reduce
mod = 10**9+7

def P(n, k):
  return reduce(lambda x, y:x*y%mod, range(n-k+1, n+1))

def factorial(n):
  return P(n, n)

def C(n, k):
  k = min(k, n-k)
  if k == 0:
    return 1
  else:
    return (P(n, k)*pow(factorial(k), mod-2, mod))%mod

X, Y = map(int, input().split())
if (X+Y)%3 == 0:
  n = Y-(X+Y)//3
  m = X-(X+Y)//3
  if n < 0 or m < 0:
    print(0)
  else:
    print(C(n+m, n))
else:
  print(0)
a = list(map(int, input().split()))

if(a[0] >= a[2]):
    a[0] = a[0] -a[2]
    a[2] = 0
     a[2] = a[2] - a[0]
elif(a[1] >= a[2]):
    a[0] = 0
    a[1] = a[1] -a[2]
else:
    a[1] = 0
print("%d %d"%(a[0],a[1]))


### FIXED CODE ###

a = list(map(int, input().split()))

t = a[0]-a[2]

if t<0:

    a[1] = a[1] +t
    if(a[1] < 0):
        a[1] = 0
    t = 0

print("%d %d"%(t,a[1]))
H=int(input())+1
A=[0]+list(map(int,input().split()))
def h(i):
 l=2*i;r=l+1
 if r<H &&l<H :
  if A[i]<A[l]:
   if A[l]<A[r]:A[i],A[r]=A[r],A[i];h(r)
   else:A[i],A[l]=A[l],A[i];h(l)
  elif A[i]<A[r]:A[i],A[r]=A[r],A[i];h(r)
 elif l<H and A[i]<A[l]:A[i],A[l]=A[l],A[i];h(l)
for i in range(H//2,0,-1):h(i)
print(' '+' '.join(map(str,A[1:])))


### FIXED CODE ###

H=int(input())+1
A=[0]+list(map(int,input().split()))
def h(i):
 l=2*i;r=l+1
 if r<H and l<H:
  if A[i]<A[l]:
   if A[l]<A[r]:A[i],A[r]=A[r],A[i];h(r)
   else:A[i],A[l]=A[l],A[i];h(l)
  elif A[i]<A[r]:A[i],A[r]=A[r],A[i];h(r)
 elif l<H and A[i]<A[l]:A[i],A[l]=A[l],A[i];h(l)
for i in range(H//2,0,-1):h(i)
print(' '+' '.join(map(str,A[1:])))
s,t=map(int,open(0).read().split());print(sum([j==i for i in s for j in t]))

### FIXED CODE ###

s,t=open(0).read().split();print(sum([j==i for i,j in zip(s,t)]))
N,Y = map(int,input().split())
if N*10000 == Y:
    print(N,0,0)
else:
    for a in range(N):
        for b in range (N-a):
            if a*10000+b*5000+1000*(N-a-b) == Y:
                print(a,b,N-a-b)
                break
        if a*10000+b*5000+1000*(N-a-b) == Y:
            break

if a == N-1 and  b == 1 and a*10000 + b*5000 < Y:
    print(-1,-1,-1)

### FIXED CODE ###

N,Y = map(int,input().split())
for a in range(N+1):
    for b in range (N+1-a):
        if a*10000+b*5000+1000*(N-a-b) == Y:
            print(a,b,N-a-b)
            exit()
print(-1,-1,-1)
import numpy as np
P=998244353
N,K=map(int,input().split())
LR=[]
for _ in range(K):
  l,r=map(int,input().split())
  LR+=range(l,r+1)
LR=list(set(LR))
LR=np.array(LR)
c=[0]*N
c[0]=1
for k in range(N):
  S=LR[LR<=k]
  while len(S):
    c[k]+=c[k-S[-1]]%P
    S=S[:-1]
print(c[-1]%P)

### FIXED CODE ###

a=input()
print(a+"s" if a[-1]!="s" else a+"es")
import sys
rr = lambda: sys.stdin.readline().strip()
rri = lambda: int(rr())
rrs = lambda: [int(_) for _ in rr().split()]

N, A_, B_, C_, D_ = rrs()
A, B, C, D = [i-1 for i in [A_, B_, C_, D_]]
S = rr()

for i in range(1, N):
	if S[i] == '#' and S[i-1] == '#':
		print('No')
		sys.exit()

if C < D:
	print('Yes')
	sys.exit()

if S[B-1] == '.' and S[B+1] == '.':
	print('Yes')
	sys.exit()

if S[B+1] == '.' and S[B+2] == '.':
	print('Yes')
	sys.exit()

if B == D - 1:
	print('Yes')
        sys.exit()

for i in range(B, D-1):
	if S[i] == '#':
		if S[i+1] == '.' and S[i+2] == '.' and S[i+3] == '.':
			print('Yes')
			sys.exit()

print('No')
sys.exit()

### FIXED CODE ###

import sys
rr = lambda: sys.stdin.readline().strip()
rri = lambda: int(rr())
rrs = lambda: [int(_) for _ in rr().split()]

N, A_, B_, C_, D_ = rrs()
A, B, C, D = [i-1 for i in [A_, B_, C_, D_]]
S = rr()

for i in range(A, max(C, D)):
	if S[i] == '#' and S[i+1] == '#':
		print('No')
		sys.exit()

if C < D:
	print('Yes')
	sys.exit()

if S[B-1] == '.' and S[B+1] == '.':
	print('Yes')
	sys.exit()

if S[B+1] == '.' and S[B+2] == '.':
	print('Yes')
	sys.exit()
	
for i in range(B, D-1):
	if S[i] == '#':
		if S[i+1] == '.' and S[i+2] == '.' and S[i+3] == '.':
			print('Yes')
			sys.exit()

print('No')
sys.exit()
s,t=input().split()
a,b=map(int.input().split())
u=input()
print(a-1,b) if s==i else print(a,b-1)

### FIXED CODE ###

s,t=input().split()
a,b=map(int,input().split())
u=input()
print(a-1,b) if s==u else print(a,b-1)
for i in range(3000):
    a, b = map(int(), input().split())
    
    if a > b:
        print(a, b)
    else
        print(b, a)
    
    
    


### FIXED CODE ###

for i in range(3000):
    a, b = map(int, input().split())
    
    if a == b == 0:
        break
    elif a < b:
        print(a, b)
    else:
        print(b, a)
s=str(input())
if s[:4]==YAKI:
    print("yes")
else:
    print("no")


### FIXED CODE ###

s=str(input())
if s[:4]=="YAKI":
    print("Yes")
else:
    print("No")
n = int(input())
li = list(map(int,input().split())) 
li.sort(reverse = True)
a,b = 0,0
while li:
    a += li.pop(0)
    b += li.pop(0)
print(a-b)

### FIXED CODE ###

n = int(input())
li = list(map(int,input().split())) 
li.sort(reverse = True)
a,b = 0,0
while li:
    a += li.pop(0)
    if len(li) == 0:
        break
    b += li.pop(0)
print(a-b)
n,m = map(int,input().split())
s = str(input())
t = str(input())
a = 0
def get_gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd):
    lcm = a * b // gcd
    return lcm
saisyou = get_lcm(n,m,get_gcd(n,m))
ans = 0
if saisyou == n or saisyou == m:
    print(-1)
else:
    for l in range(saisyou,100000,saisyou):
        num = 0
        xlis = []
        ylis = []
        for i in range(min(n,m)):
            xlis.append(1+(l/n)*i+1)
            ylis.append(1+(l/m)*i+1)
        yset = set(ylis)
        xset = set(xlis)
        for i in yset:
            hanntei = 0
            for j in xset:
                if i == j:
                    if s[j] == t[i]:
                        break
                    else:
                        hanntei += 1
                        break
            if hanntei >= 1:
                break
        num += 1
        ans = l
        break 
    if num == 1:
        print(ans)    
    else:
        print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
s = str(input())
t = str(input())
def get_gcd(a, b): #最大公約数を求める関数
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd): #みたまんまそういうやつです
    lcm = a * b // gcd
    return lcm
lcm = get_lcm(n,m,get_gcd(n,m)) #lcmはn,m最小公倍数
lcm2 = get_lcm(lcm/n,lcm/m,get_gcd(lcm/n,lcm/m)) #lcm２はlcm/nとlcm/mの最小公倍数
ans = 0
for i in range(int(lcm//lcm2)):
    if s[int(i*lcm2//(lcm/n))] == t[int(i*lcm2//(lcm/m))]:
        pass
    else:
        ans = 1
        break
if ans == 1:
    print(-1)
else:
    print(lcm)
l = [2, 1]
for i in range(2, int(input()) + 1)
    l.append(l[i-1] + l[i-2])
print(l[-1])


### FIXED CODE ###

n = int(input())
cnt = 1
l = [2, 1]
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    while True:
        cnt += 1
        l.append(l[len(l)-1] + l[len(l)-2])
        if cnt == n:
            print(l[len(l) - 1])
            exit()
K  = int(input())
A,B = map(int,input().split())

if B-A>=K-1:
    print("OK")
elif A%K > B%K:
    print("OK")
elif A%K=0 or B%K=0:
    print("OK")
else:
    print("NG")

### FIXED CODE ###

K  = int(input())
A,B = map(int,input().split())

if B-A>=K-1:
    print("OK")
elif A%K > B%K:
    print("OK")
elif A%K==0 or B%K==0:
    print("OK")
else:
    print("NG")
a = int(input())
b = a[0]
c = a[1]
if b==9 or c==9:
print("Yes")
else:
print("No")

### FIXED CODE ###

a = input()
b = int(a[0])
c = int(a[1])
if b==9 or c==9:
 print("Yes")
else:
 print("No")
return "ACL"*K

### FIXED CODE ###

k = int(input())
text = "ACL" * k
print(text)
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**5]*n
dp[0]=0
for i in range(2,n):
    for j in range(1,k):
        dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
        pront(dp[n-1])


### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**5]*n
dp[0]=0
for i in range(1,n):
    dp[i]=min(dp[j]+abs(h[j]-h[i]) for j in range(max(0,i-k),i))
print(dp[n-1])
bun=[]
bun.append([0,0]+[1]*(s-2))
for j in range(1,s//3):
    bun.append([0]*(3*(j+1)-1)+[1])
    for i in range(3*(j+1),s):
        bun[j].append((bun[j][i-1]+bun[j-1][i-3])%(10**9+7))

ans=0
for i in range(s//3):
    ans = (ans+bun[i][s-1])%(10**9+7)

print(ans)

### FIXED CODE ###

s=int(input())

bun=[]
bun.append([0,0]+[1]*(s-2))
for j in range(1,s//3):
    bun.append([0]*(3*(j+1)-1)+[1])
    for i in range(3*(j+1),s):
        bun[j].append((bun[j][i-1]+bun[j-1][i-3])%(10**9+7))

ans=0
for i in range(s//3):
    ans = (ans+bun[i][s-1])%(10**9+7)

print(ans)
N = input()
S = input()
t = []
for i in S:
    t.append(chr(ord(i) + N))
print(t.join)

### FIXED CODE ###

N = int(input())
S = input()
t = []
for i in S:
    if ord(i) + N >= 91:
        t.append(chr(ord(i) + N - 26))
    else:
        t.append(chr(ord(i) + N))
print(''.join(t))
#A
"""
a,b = map(int, input().split())
if b % a == 0:
    print(b + a)
else:
    print(b-a)
"""

#B
"""
n, m = map(int, input().split())
ans = input().split()
del ans[0]
for i in range(n-1):
    a = input().split()
    del a[0]
    for k in ans:
        if k in a:
            continue
        else:
            ans.remove(k)
    if len(ans) == 0:
        break
print(len(ans))
"""
#C
import fraction
from functools import reduce

def gcd(*numbers):
    return reduce(fraction.gcd, numbers)

def gcd_list(numbers):
    return reduce(fraction.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
print(gcd_list(a))

### FIXED CODE ###

#A
"""
a,b = map(int, input().split())
if b % a == 0:
    print(b + a)
else:
    print(b-a)
"""

#B
"""
n, m = map(int, input().split())
ans = input().split()
del ans[0]
for i in range(n-1):
    a = input().split()
    del a[0]
    for k in ans:
        if k in a:
            continue
        else:
            ans.remove(k)
    if len(ans) == 0:
        break
print(len(ans))
"""
#C
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
print(gcd_list(a))
n = int(input())
a = [int(x) for x in input().split()]
b = []
for i in range(n):
    b.append(a[i])
    b.reverse()
print(" ".join(map(str, b)))


### FIXED CODE ###

a, b, c = map(int, input().split())
li = [a,b,c]
li.sort()
print(li[0] + li[1])
S = list(input())
if len(S) > 3:
    print(int(S[0]) * int(S[1]))
else:
    print(-1)


### FIXED CODE ###

S = list(input())
if len(S) < 4:
    print(int(S[0]) * int(S[-1]))
else:
    print(-1)