Harryxun/stf_run huggingface dataset:
class Node:
	def __init__(self, id):
		self.id = id
		self.parent_id = -1
		self.depth = -1
		self.children = None
	def get_type(self):
		if self.parent_id == -1:
			return 'root'
		elif self.children == None or len(self.children) == 0:
			return 'leaf'
		return 'internal node'
	def __str__(self):
		strNode = 'node ' + str(self.id) + ': '
		strNode += 'parent = ' + str(self.parent_id) + ', '
		strNode += 'depth = ' + str(self.depth) + ', '
		strNode += self.get_type() + ', ['
		if len(self.children) > 0:
			strNode += str(self.children[0])
			for i in range(1, len(self.children)):
				strNode +=  ', ' + str(self.children[i])
		strNode += ']'
		return strNode

def calc_depth(nodes):
	stack = []
	for i in range(len(nodes)):
		if nodes[i].parent_id == -1:
			nodes[i].depth = 0
			stack.append(nodes[i].id)
			break
	while len(stack) != 0:
		node = nodes[stack.pop()]
		for i in range(len(node.children)):
			child_id = node.children[i]
			nodes[child_id].depth = node.depth + 1
			stack.append(child_id)

n = int(input())
nodes = [Node(i) for i in range(n)]
for i in range(n):
	a = list(map(int, input().split()))
	id = a[0]
	m = a[1]
	children = [0] * m
	for j in range(m):
		child_id = a[2 + j]
		child = nodes[child_id]
		child.parent_id = id
		children[j] = child_id
	nodes[id].children = children

calc_depth(nodes)

for i in range(n):


### FIXED CODE ###

class Node:
	def __init__(self, id):
		self.id = id
		self.parent_id = -1
		self.depth = -1
		self.children = None
	def get_type(self):
		if self.parent_id == -1:
			return 'root'
		elif self.children == None or len(self.children) == 0:
			return 'leaf'
		return 'internal node'
	def __str__(self):
		strNode = 'node ' + str(self.id) + ': '
		strNode += 'parent = ' + str(self.parent_id) + ', '
		strNode += 'depth = ' + str(self.depth) + ', '
		strNode += self.get_type() + ', ['
		if len(self.children) > 0:
			strNode += str(self.children[0])
			for i in range(1, len(self.children)):
				strNode +=  ', ' + str(self.children[i])
		strNode += ']'
		return strNode

def calc_depth(nodes):
	stack = []
	for i in range(len(nodes)):
		if nodes[i].parent_id == -1:
			nodes[i].depth = 0
			stack.append(nodes[i].id)
			break
	while len(stack) != 0:
		node = nodes[stack.pop()]
		for i in range(len(node.children)):
			child_id = node.children[i]
			nodes[child_id].depth = node.depth + 1
			stack.append(child_id)

n = int(input())
nodes = [Node(i) for i in range(n)]
for i in range(n):
	a = list(map(int, input().split()))
	id = a[0]
	m = a[1]
	children = [0] * m
	for j in range(m):
		child_id = a[2 + j]
		child = nodes[child_id]
		child.parent_id = id
		children[j] = child_id
	nodes[id].children = children

calc_depth(nodes)

for i in range(n):
	print(nodes[i])
from itertools import accumulate

N, K = list(map(int, input().split()))
C = list(map(int, input().split()))
A=[]
for i in range(N):
  A.append((C[i]+1)/2)
B = [0] + A
B = list(accumulate(B))

ans = []
for i in range(N-K):
    ans.append(B[i+K]-B[i])

print(max(ans))

### FIXED CODE ###

from itertools import accumulate
N, K = list(map(int, input().split()))
C = list(map(int, input().split()))
A=[]
for i in range(N):
  A.append((C[i]+1)/2)
B = [0] + A
B = list(accumulate(B))

ans = []
for i in range(N-K+1):
    ans.append(B[i+K]-B[i])
print(max(ans))
num = int(input())
numbers = list(map(int,input().split()))
sum = 1
for i in range(num):
  sum *=numbers[i]
  if (sum>(10**18)):
    sum = -1
    break
if 0 in numbers:
  sum = 0
print (sum)

### FIXED CODE ###

a,b = map(int,input().split())
print (a*b)
#C - Maximal Value
N = int(input())
B = list(map(int,input().split()))
A = [B[0]]
for i in range(1,N-1):
    if B[i] > B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])
A.append(B[-1])
print(sum(A))

### FIXED CODE ###

N = int(input())
print(N**3)
H, N = map(int, input().split())

magic = [list(map(int, input().split())) for _ in range(N)]

dp = [0 for _ in range(H+1)]

for i in range(H):
    dp[i] = min(dp[i-a]+b for a, b in magic)

print(dp[H-1])

### FIXED CODE ###

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

magic = [list(map(int, input().split())) for _ in range(N)]

dp = [0 for _ in range(10**5)]

for i in range(H):
    dp[i] = min(dp[i-a]+b for a, b in magic)

print(dp[H-1])
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    MOD = 1000000007
    N, *A = map(int, read().split())
    seq = [-1] * 3
    ans = 1
    for a in A:
        ans = ans * seq.count(a - 1) % MOD
        seq[seq.index(a - 1)] = a

    print(ans)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    MOD = 1000000007
    N, *A = map(int, read().split())
    seq = [-1] * 3
    ans = 1
    try:
        for a in A:
            ans = ans * seq.count(a - 1) % MOD
            seq[seq.index(a - 1)] = a
        print(ans)
    except:
        print(0)
        
    return


if __name__ == '__main__':
    main()
n,k = map(int,input().split())

if k%2 ==1:
  print(int(n//k)**3)
else:
  print(int((n//k)**3 + ((n+(k/2))//k)**3))


### FIXED CODE ###

n,k = map(int,input().split())

if k%2 ==1:
  print(int(n//k)**3)
else:
  print(int((n//k)**3 + ((n+(k/2))//k)**3))
input = raw_input

def isprime(n):
    if n == 1: return True
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

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

a = []
for i in range(1,int(math.sqrt(A))+1):
    if A % i == 0:
        a.append(i)
        if i != A / i:
            a.append(A/i)

b = []
for i in range(1,int(math.sqrt(B))+1):
    if B % i == 0:
        b.append(i)
        if i != B / i:
            b.append(B/i)
c = 0
for i in a:
    if i in b and isprime(i):
        c += 1
print(c)


### FIXED CODE ###

import math

input = raw_input

def isprime(n):
    if n == 1: return True
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

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

a = []
for i in range(1,int(math.sqrt(A))+1):
    if A % i == 0:
        a.append(i)
        if i != A / i:
            a.append(A/i)

b = []
for i in range(1,int(math.sqrt(B))+1):
    if B % i == 0:
        b.append(i)
        if i != B / i:
            b.append(B/i)
c = 0
for i in a:
    if i in b and isprime(i):
        c += 1
print(c)
n = int(input())
s = input()
count = 0

for k in range(n):
    if s[k] == "A" and s[k+1] =="B" and s[k+2] =="C":
        count += 1
print(count)

### FIXED CODE ###

n = int(input())
s = input()
count = 0

for k in range(n-2):
    if s[k] == "A" and s[k+1] =="B" and s[k+2] =="C":
        count += 1
print(count)
n,k=map(int,input().split())
s=input()

I=[0,]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)

if len(I)<k:
    I.extend([n+1]*(k-len(I)))

X=[]

for i in range(len(I)):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

### FIXED CODE ###


n,k=map(int,input().split())
s=input()

I=[0]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)
        
r=len(I)

for _ in range(10**6):
        I.append(n)

X=[]

for i in range(r):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))
import sys
import numpy as np
n,m = map(int, input().split())
s = list()
c = list()
for i in range(m):
    a,b = map(int, input().split())
    if not a in s:
        s.append(a)
        c.append(b)
    elif a in s and c[s.index(a)] == b:
        continue
    elif c[s.index(a)] != b:
        print('-1')
        sys.exit()
if c[np.argmin(s)] == 0:
    print('-1')
    sys.exit()
result = 0
for i,v in zip(s,c):
    result += (10**(n - i))*v
print(str(result))

### FIXED CODE ###

import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))
#D
N=int(input())
S=str(input())
count=0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if j-i!=k-j and S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                count+=1
print(count)

### FIXED CODE ###

N=str(input())
L=N.count('7')
if L>=1:
    print('Yes')
else :
    print('No')
from scipy.special import comb
from collections import Counter, deque

D = deque(map(int, list(input())))
a = {}
value = 0

for i in range(len(D)):
    value = value + D.pop() * 10**i
    modulo = value % 2019
   # print(modulo)
    if modulo in a.keys():
        a[modulo] += 1
    else:
        a[modulo] = 1


b = [comb(i, 2, exact=True) for i in a.values() if i > 1]
#print(b)
print(sum(b))


### FIXED CODE ###

import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]

S = deque(map(int, list(input())))
num = 0
dict = {}
dict[0] = 1
ans = 0

for i in range(len(S)):
    num += S.pop() * pow(10,i,2019)
    cand = num % 2019
    if cand in dict.keys():
        dict[cand] += 1
    else:
        dict[cand] = 1

for key in dict.keys():
    ans += dict[key] * (dict[key] - 1) // 2
print(ans)
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){



// }
     int linf = 1e18;
  	int n;
  	cin >> n;
  	int arr[n];
  	fo(i,0,n)cin >> arr[i];
  	sort(arr,arr+n);
  	uint64_t res = 1;
  	int flag = 1;
  	fo(i,0,n){
  		if(res*arr[i] > linf){
  			flag = 0;
  			break;
  		}
  		res = res*arr[i];
  	}
  	if(flag)cout << res << endl;
  	else cout << -1 << endl;


return 0;
}




### FIXED CODE ###

n = int(input())
arr = list(map(int,input().split()))
res = 1
flag = 1
arr.sort()
inf = int(1e18)
for i in range(n):
  res = res*arr[i]
  if(res > inf):
    flag = 0
    break
 
if(flag == 0):
  print(-1)
else:
  print(res)
def sum_digits(n):
    s = 0
    while n:
        s += n%10
        n //= 10
    retun s

n = int(input())

ans = "Yes" if n % sum_digits(n) == 0 else "No"
print(ans)

### FIXED CODE ###

def sum_digits(n):
    s = 0
    while n:
        s += n%10
        n //= 10
    return s

n = int(input())

ans = "Yes" if n % sum_digits(n) == 0 else "No"
print(ans)
import bisect
n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)])


def AirportBus(x=0, y=0):
    if x == n:
        return    
    y = min(bisect.bisect(t, t[x]+k), x+3)
    l.append(t[x:y])
    AirportBus(y)
    
l = []    
AirportBus()

print(len(l))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)])


def AirportBus(x=0,ans=0):
    y = x
    for i in range(x, n):
        if t[x]+k < t[i] or i - x >= c:
          y = i
          break
    if y == x:
      print(ans+1)
      return
    ans += 1
    AirportBus(y,ans)
    
AirportBus()
from collections import deque
import math

def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  #負辺があるケースでの、スタートからゴールへの最短路を求めるアルゴ。
    cost = [math.inf] * n
    cost[0] = 0
    for _ in range(n): #頂点の個数の分だけ回る
        updated = False
        for u,v,c in dist: #辺の個数の分だけ回る
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    #収束しない場合は負閉路があるため無限に小さくできる。
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        


n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)]  # rev_edge

for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)
    
    
use = bfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))


### FIXED CODE ###

from collections import deque
import math
    
def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  #負辺があるケースでの、スタートからゴールへの最短路を求めるアルゴ。
    cost = [float("inf")] * n
    cost[0] = 0
    for _ in range(n): #頂点の個数の分だけ回る
        updated = False
        for u,v,c in dist: #辺の個数の分だけ回る
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    #収束しない場合は負閉路があるため無限に小さくできる。
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        

n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)]  # rev_edge
for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)    
    
use = dfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
dp = [[float("inf")]*w for _ in range(h)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for j in range(h):
    for i in range(w):
        if i+1 < w:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < h:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[h-1][w-1])


### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
dp = [[float("inf")]*w for _ in range(h)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for i in range(h):
    for j in range(w):
        if i+1 < h:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < w:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[h-1][w-1])
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
for i in range(k):
  h.pop(0)


print(sum(h))

### FIXED CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
del h[0:k]


print(sum(h))
#!/usr/bin/env python3
import sys


def solve(X: int, Y: int, A: int, B: int, C: int, p: "List[int]", q: "List[int]", r: "List[int]"):
    p = sorted(p, reverse=True)
    q = sorted(q, reverse=True)
    d = sorted(p[:X] + q[:Y])
    i = 0
    for rr in r:
        if d[i] <= rr:
            d[i] = rr
            i += 1
    print(sum(d))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(A)]  # type: "List[int]"
    q = [int(next(tokens)) for _ in range(B)]  # type: "List[int]"
    r = [int(next(tokens)) for _ in range(C)]  # type: "List[int]"
    solve(X, Y, A, B, C, p, q, r)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(X: int, Y: int, A: int, B: int, C: int, p: "List[int]", q: "List[int]", r: "List[int]"):
    p = sorted(p, reverse=True)
    q = sorted(q, reverse=True)
    d = sorted(p[:X] + q[:Y] + r)
    print(sum(sorted(d, reverse=True)[:X+Y]))

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(A)]  # type: "List[int]"
    q = [int(next(tokens)) for _ in range(B)]  # type: "List[int]"
    r = [int(next(tokens)) for _ in range(C)]  # type: "List[int]"
    solve(X, Y, A, B, C, p, q, r)

if __name__ == '__main__':
    main()
n = int(input().split())
mylist = list(range(0))
inp = ''
for i in range(n):
    inp = input()
    if (inp not in mylist):
        mylist.append(inp)
print(len(mylist))

### FIXED CODE ###

n = int(input())
print(len(set([input() for i in range(n)])))
import numpy as np
k,x = map(int,input().split())

result = np.linspace(x-k+1,x+k-1,k*2-1,dtype = 'int')

for i in range(k*2-1):
    print(result[i],end = "　")

### FIXED CODE ###

import numpy as np
k,x = map(int,input().split())

result = np.arange(x-k+1,x+k,1,dtype = 'int')

for i in range(len(result)):
    print(result[i],end = " ")
from fractions import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def gcd(*numbers):
    return reduce(math.gcd, numbers)
print(gcd(a))

### FIXED CODE ###

from fractions import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def gcd_list(numbers):
    return reduce(gcd, numbers)
print(gcd_list(a))
n=int(input())
c=0
for j in range(105,n+1,2)  
  d=[]
  for i in range(1,int(j**0.5)+1):
        if j%i==0:
            d.append(i)
            if i!=n//i:
                d.append(n//i)
  if len(d)==8:
    c+=1
print(c)

### FIXED CODE ###

n=int(input())
c=0
for j in range(105,n+1,2):
  d=[]
  for i in range(1,int(j**0.5)+1):
        if j%i==0:
            d.append(i)
            if i!=n//i:
                d.append(n//i)
  if len(d)==8:
    c+=1
print(c)
def main():
    data = []
    while 1:
        n = input().split()
        a = int(n[0])
        b = int(n[1])
        c = int(n[2])
        div = 0

        for i in range(a,b):
            if c % i == 0:
                div += 1
            else:
                pass

        print(div)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    data = []
    n = input().split()
    a = int(n[0])
    b = int(n[1])
    c = int(n[2])
    div = 0

    one_div=(a == b) and c % a == 0 or c % b == 0

    if one_div:
        div = 1

    for i in range(a, b):
        div_ans = c % i
        if div_ans == 0:
            div += 1

    print(div)

if __name__ == '__main__':
    main()
N , X = map(int,input().split())
L = list(input())
cnt = 1
b = 0
lst = list()
for i in range(N):
    if int(len(L) / 2) + 1 > i   :
        lst.append(int(L[i*2]))
    else :
        break
for j in range (N):
    b += lst[j]
    cnt += 1

    if b+lst[j+1] > X :
        break
    if cnt == N:
        break
print(cnt)


### FIXED CODE ###

N , X = map(int,input().split())
L=list(map(int,input().split()))
b = 0
cnt = 1
for i in range(N):
    b += L[i]
    if b <= X   :
        cnt+=1
    else:
        break
print(cnt)
from math import gcd
n=int(input())
a=list(map(int,input().split()))
b=[]
if n==2:
  print(max(a))

else:
  for i in range(n-1):
    x=a[i]
    y=a[i+1]
    b+=list(gcd(x,y))
  b+=list(gcd(a[0],a[-1]))
  b.sort()
  print(b[2])


### FIXED CODE ###

import math

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

def segfunc(x, y):
    return math.gcd(x,y)

def init(init_val):
    # set_val
    for i in range(n):
        seg[i+num-1] = init_val[i]
    # built
    for i in range(num-2, -1, -1):
        seg[i] = segfunc(seg[2*i+1], seg[2*i+2])

def update(k, x):
    k += num - 1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[2*k+1], seg[2*k+2])

def query(p, q):
    if q <= p:
        return ide_ele
    p += num - 1
    q += num - 2
    res = ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res, seg[p])
        if q&1 == 1:
            res = segfunc(res, seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res, seg[p])
    else:
        res = segfunc(segfunc(res, seg[p]), seg[q])
    return res

# identity element
ide_ele = 0

# num: n以上の最小の2のべき乗
num = 2**(n-1).bit_length()
seg = [ide_ele]*2*num

a=init(a)

ans=1
for i in range(n):
    ans=max(ans,math.gcd(query(0,i),query(i+1,n)))


print(ans)
r,d,x = map(int,input(),.split())

for i in range(10):
  x = r*x-d
  print(x)


### FIXED CODE ###

r,d,x = map(int,input().split())

for i in range(10):
  x = r*x-d
  print(x)
N,*L = map(int, open(0).read().split())
A = L[:N]
B = L[N:]
q = []
for i in range(N):
  x,y,z = (i-1)%N,i%N,(i+1)%N
  if A[y]>=A[x]+A[z]>0:
    q.append(y)
a = 0
while q:
  y = q.pop()
  x,z = (y-1)%N,(y+1)%N
  a += A[y]//(A[x]+A[z])
  A[y] = A[y]%(A[x]+A[z])
  s = (x-1)%N
  if A[x]>=A[s]+A[y]>0:
    q.append(x)
  t = (z+1)%N
  if A[z]>=A[y]+A[t]>0:
    q.append(z)
q = []
for i in range(N):
  x,y,z = (i-1)%N,i%N,(i+1)%N
  if B[y]>=B[x]+B[z]>0:
    q.append(y)
b = 0
while q:
  y = q.pop()
  x,z = (y-1)%N,(y+1)%N
  b += B[y]//(B[x]+B[z])
  B[y] = B[y]%(B[x]+B[z])
  s = (x-1)%N
  if B[x]>=B[s]+B[y]>0:
    q.append(x)
  t = (z+1)%N
  if B[z]>=B[y]+B[t]>0:
    q.append(z)
if A==B:
  print(b-a)
else:
  print(-1)


### FIXED CODE ###

from collections import deque
N,*L = map(int, open(0).read().split())
A = L[:N]
B = L[N:]
q = deque()
for i in range(N):
  x,y,z = (i-1)%N,i%N,(i+1)%N
  if A[y]>=A[x]+A[z]>0:
    q.append(y)
a = 0
while q:
  y = q.pop()
  x,z = (y-1)%N,(y+1)%N
  if A[x]+A[z]==0:
    continue
  a += A[y]//(A[x]+A[z])
  A[y] = A[y]%(A[x]+A[z])
  s = (x-1)%N
  if A[x]>=A[s]+A[y]:
    q.append(x)
  t = (z+1)%N
  if A[z]>=A[y]+A[t]:
    q.append(z)
q = deque()
for i in range(N):
  x,y,z = (i-1)%N,i%N,(i+1)%N
  if B[y]>=B[x]+B[z]>0:
    q.append(y)
b = 0
while q:
  y = q.pop()
  x,z = (y-1)%N,(y+1)%N
  if B[x]+B[z]==0:
    continue
  b += B[y]//(B[x]+B[z])
  B[y] = B[y]%(B[x]+B[z])
  s = (x-1)%N
  if B[x]>=B[s]+B[y]:
    q.append(x)
  t = (z+1)%N
  if B[z]>=B[y]+B[t]:
    q.append(z)
if A==B and b>=a:
  print(b-a)
else:
  print(-1)