Harryxun/stf_run huggingface dataset:
import math
R = int(intput())

print(2*math.pi*R)

### FIXED CODE ###

import math

R = (int)(input())
print(2*math.pi*R)
N = int(input())
S = [input() for _ in range(N)]

T = sorted(list(set(S)))
U = [S.count(T[i]) for i in range(len(T))]

for i in range(len(T)):
    if S.count(T[i]) == max(U):
        print(T[i])

### FIXED CODE ###

n = set(map(int, input().split()))
if len(n) == 2:
    print('Yes')
else:
    print('No')
S = input(str())
W = input(str())

if S > W:
    print('safe')

elif S < W:
    print('unsafe')


### FIXED CODE ###

s, w = list(map(int, input().split()))

if w >= s:
    print("unsafe")
else:
    print("safe")
W, H, x, y, r = map(int, input(), split())
if ((x + r) <= W) and ((y + r) <= H) :
    print "Yes"
else :
    print "No"

### FIXED CODE ###

W, H, x, y, r = map(int, input().split())
if ((x-r) >= 0) and ((x+r) <= W) :
    if((y-r) >= 0) and ((y+r) <= H) :
        print ("Yes")
    else :
        print ("No")
else :
    print ("No")
cm = None
cM = None
def m(a, n, i, w):
    if w in cm[i]: return cm[i][w]
    m = abs(a[n - 1] - w)
    for k in range(i, n - 1):
        m = min(m, abs(M(a, n, k + 1, a[k])))
    cm[i][w] = m
    return m

def M(a, n, i, w):
    if w in cM[i]: return cM[i][w]
    M = abs(a[n - 1] - w)
    for k in range(i, n - 1):
        M = max(M, abs(m(a, n, k, a[k])))
    cM[i][w] = M
    return M

n, z, w = map(int, raw_input().split())
a = map(int, raw_input().split())
cm = [dict() for _ in range(n)]
cM = [dict() for _ in range(n)]
print M(a, n, 0, w)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10000)

cm = None
cM = None
def m(a, n, i, w):
    if w in cm[i]: return cm[i][w]
    m = abs(a[n - 1] - w)
    for k in range(i, n - 1):
        m = min(m, abs(M(a, n, k + 1, a[k])))
    cm[i][w] = m
    return m

def M(a, n, i, w):
    if w in cM[i]: return cM[i][w]
    M = abs(a[n - 1] - w)
    for k in range(i, n - 1):
        M = max(M, abs(m(a, n, k + 1, a[k])))
    cM[i][w] = M
    return M

n, z, w = map(int, raw_input().split())
a = map(int, raw_input().split())
cm = [dict() for _ in range(n)]
cM = [dict() for _ in range(n)]
print M(a, n, 0, w)
n,x,t = map(int(input.split()))
a = (n//x + 1)*t
print(a)

### FIXED CODE ###

n,x,t = map(int,input().split())
if n%x==0:
    print((n//x)*t)
else:
    print(((n//x)+1)*t)
N,K = map(int,input().split())
 
P = [0 for i in range(N)]
m = 0
for i in range(K):
  a = int(input())
  b = list(int,input().split())
  for j in range(a):
    P[b[j]-1] = 1
    j += 1
    
for l in range(N):
  if P[l] == 0:
    m += 1
    
peint(m)

### FIXED CODE ###

n, k = map(int, input().split())
 
m = [0]*n
 
for i in range(k):
    d = int(input())
    a = [int(x) for x in input().split()]
    for j in range(d):
        m[a[j]-1] += 1
 
print(m.count(0))
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-119, 119):
    b = a - a_factor_of_x

    ab_max =
    if not a in checked:
        checked[a_factor_of_x] = {}

    if a ** 5 - b ** 5 == x_diff_of_5th_factor:
        print('{} {}'.format(a, b))
        sys.exit(0)

sys.exit(1)


### FIXED CODE ###

import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-118, 119):
    for b in range(-119, 118):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)
n = int(input())
d, x = map(int, input().split())
a = []
s = 0

for i in range(n):
    a.appened(int(input()))

for i in range(d):
    for j in range(n):
        if i % a[j] == 1:
            s += 1
print(s + x)


### FIXED CODE ###

n = int(input())
d, x = map(int, input().split())
a = []
s = 0

for i in range(n):
    a.append(int(input()))

for i in range(1, d + 1):
    for j in range(n):
        if i % a[j] == 1 or a[j] == 1:
            s += 1
print(s + x)
N=int(input())
stock=[N-i for i in range(N)]

if N==2:
    print("Yes")
    print(2)
    print(2,1,2)
    print(2,1,2)
    exit()

N*=2
n=-int(-N**0.5//1)
if N/n==N//n:
    yoko=N//n
else:
    print("No")
    exit()

ans=[[0 for j in range(yoko)]for i in range(n)]

for i in range(N-1):
    for j in range(i,yoko):
        temp=stock.pop(-1)
        ans[i][j]=temp
        ans[j+1][i]=temp

print("Yes")
print(len(ans))
for item in ans:
    print(len(item), *item)

### FIXED CODE ###

N=int(input())
stock=[N-i for i in range(N)]

"""
if N==2:
    print("Yes")
    print(2)
    print(2,1,2)
    print(2,1,2)
    exit()
"""

N*=2
n=-int(-N**0.5//1)
if N/n==N//n and (n-N//n)==1:
    yoko=N//n
else:
    print("No")
    exit()

ans=[[0 for j in range(yoko)]for i in range(n)]

for i in range(N-1):
    for j in range(i,yoko):
        temp=stock.pop(-1)
        ans[i][j]=temp
        ans[j+1][i]=temp

print("Yes")
print(len(ans))
for item in ans:
    print(len(item), *item)
n=int(input())
al=list(map(int,input().split())
if al==set(al):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

n=int(input())
al=list(map(int,input().split()))
if len(al)==len(list(set(al))):
    print('YES')
else:
    print('NO')
r = [[(j - k) * 9 % 13 for j in range(10)] for k in range(13)]
d = [1] + [0] * 12

for c in input():
    if c == '?':
        d = [sum(d[j] for j in k) % M for k in r]
    else:
        d = [d[(int(c) - k) * 9 % 13] for k in range(13)]
    #print(d)
print(d[5])

### FIXED CODE ###

r = [[(j - k) * 9 % 13 for j in range(10)] for k in range(13)]
d = [1] + [0] * 12
M = 10 ** 9 + 7
for c in input():
    if c == '?':
        d = [sum(d[j] for j in k) % M for k in r]
    else:
        d = [d[(int(c) - k) * 9 % 13] for k in range(13)]
    #print(d)
print(d[5])
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
input = sys.stdin.readline
N,K = map(int,input().split())
A.sort()
F.sort(reverse=True)
print(A)
print(F)
maxi = 0
for i in range(N):
    maxi = max(maxi,A[i]*F[i])
start=0
end = maxi
while True:
    count = 0
    value = (start+end)//2
    for i in range(N):
        count += max(0,A[i]-value//F[i])
    if count == K:
        break
    elif count > K :
        if 2 > end-start:
            value +=1
            break
        start = value
    else:
        if 2 > end-start:
            break
        end = value
print(value)

### FIXED CODE ###

import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
input = sys.stdin.readline
N,K = map(int,input().split())
A = [int(i) for i in input().split()]
F = [int(i) for i in input().split()]
A.sort()
F.sort(reverse=True)
maxi = 0
for i in range(N):
    maxi = max(maxi,A[i]*F[i])
start=0
end = maxi
while True:
    count = 0
    value = (start+end)//2
    for i in range(N):
        count += max(0,A[i]-value//F[i])
    if count > K :
        if 2 > end-start:
            value +=1
            break
        start = value
    else:
        if 2 > end-start:
            break
        end = value
print(value)
from sys import stdin
import numpy as np


def main():
    n, m = list(map(int, stdin.readline().split()))
    hList = list(map(int, stdin.readline().split()))
    ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]
    hRelations = np.zeros((n, n))
    '''
    for a, b in ABList:
        if hList[a-1] >= hList[b-1]:
            hRelations[b-1, a-1] = 1
        if hList[b-1] >= hList[a-1]:
            hRelations[a-1, b-1] = 1
    total = 0
    print(total)
    for hRelation in hRelations:
        if hRelation.sum() == 0:
            total += 1
    print(total)
    '''


if __name__ == '__main__':
    main()


### FIXED CODE ###

from sys import stdin
import numpy as np


def main():
    n, m = list(map(int, stdin.readline().split()))
    hList = list(map(int, stdin.readline().split()))
    ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]
    maxHeights = np.zeros(n)
    for a, b in ABList:
        if hList[a-1] >= maxHeights[b-1]:
            maxHeights[b-1] = hList[a-1]
        if hList[b-1] >= maxHeights[a-1]:
            maxHeights[a-1] = hList[b-1]
    total = 0
    i = 0
    for maxHeight in maxHeights:
        if maxHeight < hList[i]:
            total += 1
        i += 1
    print(total)


if __name__ == '__main__':
    main()
MIN = -(10**7)-1

def solve():
    cnt = 0
    i = 0
    for lst in f_lst:
        chk_range = sum(lst)
        cnt += max(p_lst[i][1:chk_range])
        i += 1
    if cnt < 0:
        cnt = min(min(p_lst))
    return cnt


n = int(input())
f_lst = [[] for _ in range(n)]
p_lst = [[] for _ in range(n)]
for i in range(n):
    f_lst[i].extend(map(int,input().split()))
for i in range(n):
    p_lst[i].extend(map(int,input().split()))

ans = solve()
print(f_lst)
print(p_lst)
print(ans)


### FIXED CODE ###

n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]
res = -float('inf')
for i in range(1,1<<10):
    cnt = [0 for _ in range(n)]
    for j in range(10):
        for k in range(n):
            if (i>>j)&1 and f[k][10-j-1]:
                cnt[k] += 1
    total = 0
    for k in range(n):
        total += p[k][cnt[k]]
    res = max(res,total)
print(res)
( a, b) = input(), sprit()
a = int(a)
b = int(b)
a*b a*2+b*2

### FIXED CODE ###

( a, b) = input().split()
a = int(a)
b = int(b)
print(a*b, a*2+b*2)
k=int(input())
i=1
if k%7==0:
    while (10**i)%(9*k/7)!=1:
        i+=1

else:
    while (10**i)%(9*k)!=1:
        i+=1



print(i)
                                        
                                        
    

### FIXED CODE ###

k=int(input())
a=[]
judge=0
a.append("")
a.append(7%k)
for i in range(2,k+1):
    a.append((a[i-1]*10+7)%k)
for i in range(1,k+1):
    if a[i]==0:
        print(i)
        judge=1
        break
if judge==0:
    print(-1)
num = int(input())
A_i = [ int(x) for x in input().split()]
B_i = [ int(x) for x in input().split()]
C_i = [ int(x) for x in input().split()]

prev = 0
for a in a_i:
  result += B_i[a]
  if prev > 0 and a-1 == prev:
    result += C_i[prev]
  
print(result)

### FIXED CODE ###

num = int(input())
A_i = [ int(x) for x in input().split()]
B_i = [ int(x) for x in input().split()]
C_i = [ int(x) for x in input().split()]
 
prev = 50
result = 0
for a in A_i:
  result += B_i[a-1]
  if a-1 == prev:
    result += C_i[prev-1]
  prev = a
  
print(result)
K = int(input())
S = input()
sentence = list(S)

for i in range(K):
  print(sentence[i], end="")
  
print("...")

### FIXED CODE ###

K=int(input())
S=input()

if len(S) > K:
  S = S[:K] + "..."
  
print(S)
N = int(input())
a = [int(input()) for i in range(N)]
ch = [0] * 10**5
ch[1] = 1

if a[0] == 1 or a[1]  == 2:
    print(-1)

numB = 1
c = 1
while True:
    numB = a[numB-1]
    if numB == 2:
        print(c)
        break
    if ch[numB] == 1:
        print(-1)
        break
    c += 1
    ch[numB] = 1


### FIXED CODE ###

N = int(input())
a = [int(input()) for i in range(N)]
ch = [0] * (10**5 + 1)
numB = 1
ch[1] = numB
c = 1
while True:
    numB = a[numB-1]
    if numB == 2:
        print(c)
        break
    if ch[numB] == 1:
        print(-1)
        break
    c += 1
    ch[numB] = 1
a,b,c=map(int,input().split())
K=int(input())
if a<b:
    if b<c:
        flag=0
    else:
        if b<c*(2**K):
            flag=0
        else:
            flag=1
else:
    while a>=b:
        if K>0:
            b=b*2
            K-=1
        else:
            flag=1
            break
    if K>0:
        if b<c:
            flag=0
        else:
            if b<c*(2**K):
                flag=0
            else:
                flag=1
if flag==0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b,c=map(int,input().split())
K=int(input())
flag=0
if a>=b:
    while a>=b:
        if K>0:
            b=b*2
            K-=1
        else:
            flag=1
            break
if b>=c and flag==0:
    while b>=c:
        if K>0:
            c=c*2
            K-=1
        else:
            flag=1
            break
            
if flag==0:
    print("Yes")
else:
    print("No")
a, b = map(raw_input().split(' '))
print a*b, (a+b)*2

### FIXED CODE ###

a, b = map(int, raw_input().split(" "))
print a*b, (a+b)*2
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
# visited = [False for _ in range(N)]
def dfs(start,stop,visitedArray):
    visitedArray[start] = True
    if start == stop:
        return
    else:
        for term in edges[start]:
            if visitedArray[term]:
                continue
            dfs(term,stop,visitedArray)
fennec = [False for _ in range(N)]
snuke = [False for _ in range(N)]
dfs(0,N-1,fennec)
dfs(N-1,0,snuke)
# print(fennec)
# print(snuke)
F = S = C = 0
for i in range(1,N-1):
    if fennec[i] and snuke[i]:
        C += 1
    else:
        if fennec[i]:
            F += 1
        else:
            S += 1
# F = fennec + common//2 + common%2
# S = snuke + common//2
# print(F,S,C)
F += C//2 + C%2
S += C//2
if F > S:
    print("Fennec")
else:
    print("Snuke")

### FIXED CODE ###

import sys
sys.setrecursionlimit(2*10**5)
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
fennec = [-1 for _ in range(N)]
snuke = [-1 for _ in range(N)]
def dfs(start,visited,distance,d):
    visited[start] = True
    d[start] = distance
    for term in edges[start]:
        if visited[term]:
            continue
        dfs(term,visited,distance + 1,d)
dfs(0,visited,0,fennec)

visited = [False for _ in range(N)]
    
dfs(N-1,visited,0,snuke)
F = S = 0
for i in range(N):
    if fennec[i] <= snuke[i]:
        F+=1
    else:
        S+=1
if F>S:
    print("Fennec")
else:
    print("Snuke")
from collections import Counter
from numba import njit

@njit
def solve(S, C):
    if C["R"] == 3:
        print(3)
    elif C["R"] == 2:
        if S[1] == "S":
            print(1)
        else:
            print(2)
    elif C["R"] == 1:
        print(1)
    else:
        print(0)

def main():
    S = input()
    C = Counter(S)
    solve(S,C)
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import Counter
def main():
    S = input()
    C = Counter(S)
    if C["R"] == 3:
        print(3)
    elif C["R"] == 2:
        if S[1] == "S":
            print(1)
        else:
            print(2)
    elif C["R"] == 1:
        print(1)
    else:
        print(0)
        
if __name__ == '__main__':
    main()
print(((int(input()))/3)^3)


### FIXED CODE ###

s = int(input())
side = s/3
ans = pow(side,3)
print(ans)
import sys

n = int(input())
a = map(int, sys.stdin.read().split("\n"))
# a = map(int, [input() for i in range(n)])

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] = (d[a_i]+1) % 2

print(sum(d.values()))

### FIXED CODE ###

import sys

n = int(input())
# a = map(int, sys.stdin.read().split("\n"))
a = map(int, [input() for i in range(n)])

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] = (d[a_i]+1) % 2

print(sum(d.values()))
n, m = [int(x) for x in input().split()]
img_a = []
img_b = []

for i in range(n):
    img_a.append(input())

for i in range(m):
    img_b.append(input())

ans = "No"
for a in range(n - m + 1):
    dup_a = img_a.copy()
    dup_b = img_b.copy()
    flag = True
    while flag:
        for b in range(m):
            if dup_b[b] in dup_a[b+a]:
                if b == 0:
                    index = dup_a[a].index(dup_b[0])
                current_index = dup_a[b+a].index(dup_b[b])
                if current_index == index:
                    continue
                elif current_index > index:
                    for line in dup_a:
                        del line[:current_index]
                    break
                else:
                    for line in dup_a:
                        del line[:index]
                    break
            else:   # if not substring in string.
                flag = False
                break

        else: # if not loop broken.
            ans = "Yes"
            break
        

print(ans)

### FIXED CODE ###

n, m = [int(x) for x in input().split()]
img_a = []
img_b = []

for i in range(n):
    img_a.append(input())

for i in range(m):
    img_b.append(input())

ans = "No"
for a in range(n - m + 1):
    border = 0
    flag = True
    while flag:
        for b in range(m):
            if img_b[b] in img_a[b+a][border:]:
                if b == 0:
                    index = img_a[a].index(img_b[0], border)
                current_index = img_a[b+a].index(img_b[b], border)
                if current_index == index:
                    continue
                elif current_index > index:
                    border = current_index
                    break
                else:
                    border = index
                    break
            else:   # if not substring in string.
                flag = False
                break

        else: # if not loop broken.
            ans = "Yes"
            break
        

print(ans)
C010_scrambled

### FIXED CODE ###

N = int(input())
S = input().strip()
ans = 0
for i in range(N-2):
    if S[i:i+3] == 'ABC':
        ans += 1
print(ans)
N,K = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
l.sorted()
for i in range(K):
  ans += l[i]
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(K):
  ans += L[-(i+1)]
print(ans)
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = [int(c) for c in str(n)]
    if A <= sum(inputList) <= B:
        outValue += n

print(outValue)


### FIXED CODE ###

# -*- coding: utf-8 -*-
strList = list(map(int, input().split()))

N = strList[0]
A = strList[1]
B = strList[2]

outValue = 0
for n in range(N+1):
    strList = [int(c) for c in str(n)]
    if A <= sum(strList) <= B:
        outValue += n

print(outValue)
import math

R = input()

print(R*R*math.pi)


### FIXED CODE ###

from math import pi

r = int(input())

print(2*r*pi)
while(True):
    line = raw_input()
    s = line.rstrip().split()
    for i in range(6):
        s[i] = int(s[i])
    print (s[2]*s[4] - s[1]*s[5])/(s[0]*s[4] - s[1]*s[3]), (s[1]*s[5] - s[3]*s[2]) / (s[0]*s[4] - s[1]*s[3])

### FIXED CODE ###

# -*- coding: utf-8 -*-

while True:
    try:
        list = [float(x) for x in raw_input().split() ]
        x = (list[2]*list[4]-list[1]*list[5])/(list[0]*list[4]-list[1]*list[3])+0
        y = (list[0]*list[5]-list[2]*list[3])/(list[0]*list[4]-list[1]*list[3])+0

        print("%.3f %.3f" %(x, y))

    except EOFError:
        break
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

s1,s2,s3=map(str,input().split())

if s1[-1]==s2[0] and s2[-1]=s3[0]:
	print("YES")
else:
	print("NO")

### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

s1,s2,s3=map(str,input().split())

if s1[-1]==s2[0] and s2[-1]==s3[0]:
	print("YES")
else:
	print("NO")
while True:
    try:
        line=input()

    except:
        break

    a,b,c,d,e,f=map(int, line.strip().split())

    z=a*e-b*d
    
    if z!==0:  
        y=(c*d-f*a)/(b*d-a*e)
        x=(c*e-f*b)/(a*e-b*d)
        print('{:.3f} {:.3f}'.format(x,y))
    
    

### FIXED CODE ###

while True:
    try:
        line=input()

    except:
        break

    a,b,c,d,e,f=map(int, line.strip().split())

   
    
    y=(c*d-f*a)/(b*d-a*e)
    x=(c*e-f*b)/(a*e-b*d)

    if x<=0 and x>=-0.0005:
        x=0.000
    
    if y<=0 and y>=-0.0005:
        y=0.000
        
    print('{:.3f} {:.3f}'.format(x,y))
ans = (H * W)
if ans % 2 == 1:
    print(ans // 2 + 1)
else:
    print(ans // 2)

### FIXED CODE ###

H, W = map(int, input().split())

ans = H * W
if H == 1 or W == 1:
    print(1)
elif ans % 2 == 1:
    print(ans // 2 + 1)
else:
    print(ans // 2)
s = string(input())
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

### FIXED CODE ###

s = input()

if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


N = int(input())
a = make_divisors(N)
b = []
c = []

for j in range(round(len(a)):
    for k in range(len(a)):
        if a[j] * a[k] == N:
            b.append([a[j],a[k]])

for l in range(len(b)):
    c.append(b[l][0] + b[l][1])

print(b)
print(min(c) - 2)


### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

N = int(input())
a = make_divisors(N)
b = []
c = []

for j in range(len(a)):
    for k in range(len(a)):
        if a[j] * a[k] == N:
            b.append([a[j],a[k]])

for l in range(len(b)):
    c.append(b[l][0] + b[l][1])

print(min(c) - 2)
x,a,b=int((input() for _ in range(3)))
print((x - a)%b)


### FIXED CODE ###

x,a,b=(int(input()) for _ in range(3))
print((x - a)%b)
n = int(input())
l = []
for i in range(1,n**(0.5)):
  l.append(i**2)
print(l[-1])

### FIXED CODE ###

n = int(input())
p = 1
for i in range(10):
  p = p*2
  if(p>n):
    print(2**i)
    break
def rem(x,r):
  if (x,r) == (1,0):
    return [[1]]
  if x <= 2*r:
    return -1
  ret = []
  for i in range(1,x+1):
    if x%i == r:
      ret.append([i])
    else:
      s = rem(x%i,r)
      if s == -1:
        continue
      else:
        for j in s:
          if j == -1:
            continue
          elif j[-1] < i:
            ret.append([i]+j)
          else:
            ret.append([i]+j)
  return ret
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for xx,yy in zip(x,y):
  if xx != yy and rem(xx,yy) == -1:
    print(-1)
    exit()
ls = [rem(xx,yy) if xx != yy else 0 for xx,yy in zip(x,y)]
flg = [0]*n
def findmx(lsi,ansst,mx):
  ret = 100
  if lsi == 0:
    return 0
  for lsls in lsi:
    for j in lsls:
      if j > mx:
        return min(j,ret)
      elif j in ansst:
        continue
      else:
        ret = min(j,ret)
        break
    else:
      return 0
  else:
    return ret
    
mxls = [ls[i][0][0] if type(ls[i]) == list else 0 for i in range(n)]
mx = max(mxls)
ansst = set((mx,))
mxcand = mx
while mxcand:
  for i in range(n):
    t = findmx(ls[i],ansst,mx)
    mxls[i] = t
    if t == 0:
      flg[i] = 1
  mxcand = max(mxls)
  ansst.add(mxcand)
  if flg.count(1) == n:
    break
ans = 0
for b in ansst:
  if b:
    ans += 2**b
print(ans)

### FIXED CODE ###

from bisect import bisect
s=input()
n=len(s)
ls=[0]*26
if s == "zyxwvutsrqponmlkjihgfedcba":
  print(-1)
  exit()
if n<26:
  for i in range(n):
    ls[ord(s[i])-97]=i+1
  for i in range(26):
    if ls[i]==0:
      x=i
      break
  print(s+chr(x+97))
else:
  for i in range(n):
    ls[i] = ord(s[i])-97
  if ls[25]>ls[24]:
    print(s[:24]+s[25])
  else:
    tmp = []
    for i in range(24,-1,-1):
      tmp.append(ls[i+1])
      if ls[i+1]>ls[i]:
        tmps = sorted(tmp)
        x = bisect(tmps,ls[i])
        print(s[:i]+chr(tmps[x]+97))
        break
import math
a,b,x=map(int,input().split())
if a*a*b/2<x:
    theta=a/(2*b-2*x/a**2)
else:
    theta=2*x/(a*b*b)
print(90-math.atan(theta)*180/math.pi)

### FIXED CODE ###

import math
a,b,x=map(int,input().split())
if a*a*b/2<x:
    theta=(2*b-2*x/a**2)/a
else:
    theta=b**2*a/2/x
print(math.atan(theta)*180/math.pi)