Harryxun/stf_run huggingface dataset:
import math

from sys import stdin


def main():
    n = int(stdin.readline())
    t = [int(stdin.readline()) for _ in range(n)]
    dp = [0 for _ in range(n)]
    dp[0] = t[0]
    for i in range(1, n):
        dp[i] = t[i] * dp[i-1] // math.gcd(t[i], dp[i-1])
    print(dp[-1])


if __name__ == "__main__":
    main()


### FIXED CODE ###

import fractions

from sys import stdin


def main():
    n = int(stdin.readline())
    t = [int(stdin.readline()) for _ in range(n)]
    dp = [0 for _ in range(n)]
    dp[0] = t[0]
    for i in range(1, n):
        dp[i] = t[i] * dp[i-1] // fractions.gcd(t[i], dp[i-1])
    print(dp[-1])


if __name__ == "__main__":
    main()
def resolve():
    from decimal import Decimal
    import numpy as np

    n = int(input())
    A = np.array(list(map(Decimal, input().split())))
    a = np.prod(A)
    if a > 10**18:
        print(-1)
    else:
        print(a)

resolve()

### FIXED CODE ###

def resolve():
    import numpy as np
    from decimal import Decimal

    n = int(input())
    A = np.array(list(map(Decimal, input().split())))
    if 0 in A:
        print(0)
        return

    a = Decimal(1)
    for b in A:
        a *= b
        if a > 10**18:
            print(-1)
            return
    print(a)

resolve()
import sys
x=int(sys.argv)

print ([0 if i==1 else 1 for i in x])

### FIXED CODE ###

x=int(input())
print (0 if x==1 else 1)
a=int(input())
b=0
for i in range(a):
  c=input().split()
  if c[1]=='BTC':
    b+=(float)c[0]*380000.0
  else:
    b+=(float)c[0]
print(b)
    
    
  
  


### FIXED CODE ###

a=input().split('/')
if int(a[1])<=4:
  print("Heisei")
else:
  print("TBD")
N = int(input())
S = list(input())

if S == ['#'] * N or S == ['.'] * N:
    print(0)
    exit()
ans = 0
b, w = 0, 0
for j in range(N):
    if S[j] == '.':
        w += 1
    else:
        b += 1
    if b <= w and b != 0 and w != 0:
        ans += b
        num = j
        b, w = 0, 0

b, w = 0, 0
for j in range(N - 1, num, -1):
    if S[j] == '.':
        w += 1
    else:
        b += 1
    if b >= w and b != 0 and w != 0:
        ans += w
        b, w = 0, 0

print(ans)

### FIXED CODE ###

N = int(input())
S = list(input())

w_cnt = [0]
w = 0
for s in S:
    if s == '.':
        w += 1
    w_cnt.append(w)

b_cnt = [0]
b = 0
for s in S[::-1]:
    if s == '#':
        b += 1
    b_cnt.append(b)
b_cnt.reverse()


ans = float('inf')
i = 0
for b, w in zip(b_cnt, w_cnt):
    ww, bb = i, N - i
    ans = min(ans, abs(b - bb) + abs(w - ww))
    i += 1
print(ans)
import numpy as np
h,q=map(int,input().split())
#動きの確認code,0が裏,1を表
"""
box=[["*"]+["1"]*h+["*"] for i in range(q)]
box.insert(0,["*"]*(h+2))
box.append(["*"]*(h+2))
print(np.array(box))
for i in range(1,q+1):
    for j in range(1,h+1):
        try:
            seat=[[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]
            for x,y in seat:
                xx=i+x
                yy=j+y
                if box[xx][yy]=="1":
                    box[xx][yy]="0"
                elif box[xx][yy]=="0":
                    box[xx][yy]="1"
                elif box[xx][yy]=="*":continue
        except:continue
print(np.array(box))
"""
if h==2 or q==2:print(0)
elif h==1 or q==1:
    if h!=1:print((h-2)*1)
    elif q!=1:print((q-2)*1)
    else:print(1)
else:
    print((h-2)*(q-2))

### FIXED CODE ###

h,q=map(int,input().split())

if h==2 or q==2:print(0)
elif h==1 or q==1:
    if h!=1:print((h-2)*1)
    elif q!=1:print((q-2)*1)
    else:print(1)
else:
    print((h-2)*(q-2))
import numpy as np
n = int(input())
sum(np.arange(n))

### FIXED CODE ###

import numpy as np
n = int(input())
print(n * (n-1) // 2)
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = [x % 13 for x in range(0, p * 10, p)] if c == '?' else (p * int(c),)
    a = [sum(a[(i - j, i - j + 13)[i < j]] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])


### FIXED CODE ###

M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = range(10) if c == '?' else (int(c),)
    a = [sum(a[(i - p * j) % 13] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])
n =  int(input())
a =[int(input) for _ in range(n)]
b = 0
rev_a =[]

for i in a:
    j = 1 / i
    rev_a.append(j)

for k in rev_a:
    b += k

print(1/b)
  
  



### FIXED CODE ###

n =  int(input())
a =list(map(int,input().split()))
rev_a=[]
b=0
       

for i in a:
    j = 1 / i
    rev_a.append(j)
b=0
for k in rev_a:
    b += k

print(1/b)
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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


class FactMod():
    '''
    modの値が素数の時のfactと組み合わせを求める
    フェルマーの小定理を用いているため、modが素数以外の時は使えない
    '''

    def __init__(self, n, mod):
        '''
        コンストラクタ
        f:nまでの i!の値を　配列に入れる
        inv: (i!)^-1　の値を配列に入れる
        '''
        self.mod = mod
        self.f = [1]*(n+1)
        for i in range(1, n+1):
            self.f[i] = self.f[i-1]*i % mod

        self.inv = [pow(self.f[-1], mod-2, mod)]
        for i in range(1, n+1)[::-1]:
            self.inv.append(self.inv[-1]*i % mod)
        self.inv.reverse()

    def fact(self, n):
        '''
        n!の値を返す
        '''
        return self.f[n]

    def comb(self, n, r):
        '''
        nCrの値を返す
        '''
        ret = self.f[n] * self.inv[n-r]*self.inv[r]
        ret %= self.mod
        return ret

    def perm(self, a, b):
        if a < b:
            return 0
        ret = self.f[a]*self.inv[a-b]
        ret %= self.mod
        return ret


MOD = 10**9+7
N, K = map(int, input().split())
edges = [list(map(lambda x:int(x)-1, input().split())) for _ in range(N-1)]
adj = [[] for _ in range(N)]

F = FactMod(N, MOD)

for a, b in edges:
    adj[a].append(b)
    adj[b].append(a)

# current parent
Q = []
for a in adj[0]:
    Q.append((a, 0))
ans = F.perm(K, len(adj[0])+1)
ans %= MOD

while Q:
    current, prev = Q.pop()
    child = len(adj[current])-1
    ret = F.perm(K-2, child)
    ans *= ret

    ans %= MOD
    for a in adj[current]:
        if a == prev:
            continue
        else:
            Q.append((a, current))
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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


class FactMod():
    '''
    modの値が素数の時のfactと組み合わせを求める
    フェルマーの小定理を用いているため、modが素数以外の時は使えない
    '''

    def __init__(self, n, mod):
        '''
        コンストラクタ
        f:nまでの i!の値を　配列に入れる
        inv: (i!)^-1　の値を配列に入れる
        '''
        self.mod = mod
        self.f = [1]*(n+1)
        for i in range(1, n+1):
            self.f[i] = self.f[i-1]*i % mod

        self.inv = [pow(self.f[-1], mod-2, mod)]
        for i in range(1, n+1)[::-1]:
            self.inv.append(self.inv[-1]*i % mod)
        self.inv.reverse()

    def perm(self, a, b):
        if a < b or a < 0 or b < 0:
            return 0
        ret = self.f[a]*self.inv[a-b]
        ret %= self.mod
        return ret


MOD = 10**9+7
N, K = map(int, input().split())
edges = [list(map(lambda x:int(x)-1, input().split())) for _ in range(N-1)]
adj = [[] for _ in range(N)]

F = FactMod(K+1, MOD)

for a, b in edges:
    adj[a].append(b)
    adj[b].append(a)

# current parent
Q = []
for a in adj[0]:
    Q.append((a, 0))
ans = F.perm(K, len(adj[0])+1)
ans %= MOD

while Q:
    current, prev = Q.pop()
    child = len(adj[current])-1
    ret = F.perm(K-2, child)
    ans *= ret
    ans %= MOD
    for a in adj[current]:
        if a == prev:
            continue
        else:
            Q.append((a, current))
print(ans)
# ABC158 D
from collections import deque
s=input()
q=int(input())
l=[]

for i in range(q):
    l.append(list(map(str,input().split())))

cnt=0
front_str=''
end_str=''
t_str=deque(s)
front_str=deque(front_str)
end_str=deque(end_str)
for ll in l:
    if ll[0]=='1':
        cnt+=1
    elif ll[0]=='2':
        if cnt%2==0:
            if ll[1]=='1':
                front_str.appendleft(ll[2])
            elif ll[1]=='2':
                end_str.append(ll[2])
        elif cnt%2==1:
            if ll[1]=='1':
                end_str.appendleft(ll[2])
            elif ll[1]=='2':
                front_str.appendleft(ll[2])
ans=front_str+t_str+end_str
ans=list(ans)

if cnt%2==0:
    ans=''.join(ans)
else:
    ans=ans[::-1]
    ans=''.join(ans)
print(ans)



### FIXED CODE ###

# ABC158 D
from collections import deque
s=input()
q=int(input())
l=[]

for i in range(q):
    l.append(list(map(str,input().split())))

cnt=0
front_str=''
end_str=''

t_str=deque(s)
front_str=deque(front_str)
end_str=deque(end_str)

for ll in l:
    if ll[0]=='1':
        cnt+=1
    elif ll[0]=='2':
        if cnt%2==0:
            if ll[1]=='1':
                front_str.appendleft(ll[2])
            elif ll[1]=='2':
                end_str.append(ll[2])
        elif cnt%2==1:
            if ll[1]=='1':
                end_str.append(ll[2])
            elif ll[1]=='2':
                front_str.appendleft(ll[2])
ans=list(front_str)+list(t_str)+list(end_str)

if cnt%2==0:
    ans=''.join(ans)
else:
    ans=ans[::-1]
    ans=''.join(ans)
print(ans)
print(input()[::-1])

### FIXED CODE ###

print(raw_input()[::-1])
# -*- coding: utf-8 -*-
from collections import deque

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

positives = deque(sorted(a))
negatives = deque([positives.popleft()])
for i in range(n - 1):
    if a[i] < 0:
        negatives.append(positives.popleft())
    else:
        break

# print M
print(sum(positives) - sum(negatives))

while len(positives) > 1:
    y = positives.popleft()
    x = negatives.pop()
    print(x, y)
    negatives.append(x - y)

x = positives.popleft()

while len(negatives) > 0:
    y = negatives.pop()
    print(x, y)
    x = x - y

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import deque

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

positives = deque(sorted(a))
negatives = deque([positives.popleft()])
while len(positives) > 1:
    if positives[0] < 0:
        negatives.append(positives.popleft())
    else:
        break

# print M
print(sum(positives) - sum(negatives))

while len(positives) > 1:
    y = positives.popleft()
    x = negatives.pop()
    print(x, y)
    negatives.append(x - y)

x = positives.popleft()

while len(negatives) > 0:
    y = negatives.pop()
    print(x, y)
    x = x - y
n, m = get(int, input().split())
print(n * m - min(2, n) * min(2, m))

### FIXED CODE ###

n, m = map(int, input().split())
if n == 1:
    n += 2
if m == 1:
    m += 2
print((n-2) *(m-2))
#coding: UTF-8

x=input()

i=1

while x !='0':
    print('Case '+i+': '+x)
    i +=1




### FIXED CODE ###

c = 0

while True:
    x = int(input())
    c +=1
    
    if x == 0:
        break
   
    print("Case {}: {}".format(c, x))
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True)

thold = sum(a) // (4 * m)

if a[m] <= thold:
    print('No')
else:
    print('Yes')



### FIXED CODE ###

x, y, z = map(int, input().split())

x, y = y, x
x, z = z, x

print(x, y, z)
n, m = map(int, input().split())
dic = {i: [] for i in range(1, n + 1)}
for _ in range(m):
    s_, c_ = map(int, input().split())
    if dic[s_]:
        if dic[s_][0] != c_:
            print(-1)
            exit()
        else: continue
    dic[s_].append(c_)
res = ""
if dic[1][0] == 0:
    print(-1)
    exit()
for k in dic.keys():
    if dic[k]:
        res += str(dic[k][0])
    else:
        if k == 1:
            res += "1"
        else:
            res += "0"
print(res)

### FIXED CODE ###

n, m = map(int, input().split())
sc = []
for _ in range(m):
    s_, c_ = map(int, input().split())
    sc.append([s_-1, c_])
ans = [-1 for _ in range(n)]
for s, c in sc:
    if s == 0 and c == 0:
        if n != 1:
            print(-1)
            exit()
    if ans[s] is -1: ans[s] = c
    elif ans[s] is not None and ans[s] != c:
        print(-1)
        exit()
for i in range(n):
    if ans[i] == -1:
        if i == 0:
            if n == 1: ans[i] = 0
            else: ans[i] = 1
        else:
            ans[i] = 0
print("".join(map(str, ans)))
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    cost = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(cost*(0.08))==a:
            if int(cost*(0.1))==b:
                break
        mn += 1
        if i ==inter*2-1:
            cost = -1
print(cost)

### FIXED CODE ###

a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    mn = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(mn*(0.08))==a:
            if int(mn*(0.1))==b:
                break
        mn += 1
        if i ==inter*2-1:
            mn = -1
print(mn)
n = int(input())
h = list(map(int,input().split()))

for i in range(1,n-1):
    if h[i-1] <= h[i] <= h[i+1]:
        continue
    else:
        if h[i]>h[i+1]:
            h[i] -= 1
            if h[i]< h[i-1]:
                print('No')
                exit()

for i in range(1,n-1):
    if not h[i-1]=<h[i] <= h[i+1]:
        print('No')
        exit()

print('Yes')

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
m = h[0]
for i in range(1,n):
    m = max(m,h[i])
    if h[i] >= m-1:
        continue
    print('No')
    exit()


print('Yes')
n=int(input())
arr=list(map(int,input().split()))
if n < 2:
  print(0)
vis={}
vis[0] = 0
vis[1] = 0
if n > 1:
  vis[2] = abs(arr[0]-arr[1])
if n == 2:
  print(vis[2])
for i in range(3, n+1):
    step_1 = abs(arr[i-1]-arr[i-2]) + vis[i-1]
    step_2 = abs(arr[i-1]-arr[i-3]) + vis[i-2]
    vis[i] = min(step_1, step_2)
   
print(vis[i])

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
if n < 2:
  print(0)
vis = [0] * n
vis[0] = 0
vis[1] = abs(arr[0]-arr[1])
for i in range(2, n):
    step_1 = abs(arr[i]-arr[i-1]) + vis[i-1]
    step_2 = abs(arr[i]-arr[i-2]) + vis[i-2]
    vis[i] = min(step_1, step_2)
print(vis[-1])
n,k = map(int, input().split())
s = []
ans = 0
rangecounter = 0
for i in range(k-1):
  d = int(input())
  rangecounter += d
  for j in range(d):
    s.append(input().split())
for i in range(rangecounter):
  if s.count(i) == 0:
    ans += 1
print(ans)

### FIXED CODE ###

n , k = map(int,input().split())
ans = [0] * n
for i in range(k):
  d = int(input())
  for j in list(map(int,input().split())):
    ans[j-1] = 1
print(ans.count(0))
#prdさんから参照
N = int(input())
#これが唯一の事実データ
src = [tuple(map(int,input().split())) for i in range(N)]
 
INF = float('inf')
#ここ以降でかかれてあるcx,cyはあくまで頂上であると仮定しているだけで条件と合わない場合に不適切な座標となる。
for cx in range(0,101):
    for cy in range(0,101):
        tmph = None
        maxh = INF
        for x,y,h in src:
            if h > 0:
                tmp = h + abs(x-cx) + abs(y-cy)
                if tmph is None:
                    tmph = tmp
                else:
                    if tmp != tmph:
                        break
#                 if tmph > maxh:
#                     break
            else:
                #ここでmaxhがtmphよりも小さくなってしまった場合、hは0だから頂点からのxとyの差の和がtmphはなければならないのに、それを下回っているため
                #データx,yは絶対的な値なのでcx,cyが間違っていることになる。それを判定するのが上のtmph > maxh の時となり
                maxh = min(maxh, abs(x-cx) + abs(y-cy))
                #最低でも1つはピラミッド内の座標がないと解けないのでここはいらない？
#                 if maxh == 1:
#                     tmph = 1
                 if tmph > maxh:
                    break
        else:
#             for x,y,h in src:
#                 if max(tmph - abs(x-cx) - abs(y-cy), 0) != h:
#                     break
#             else:
            print(cx,cy,tmph)
            exit()

### FIXED CODE ###

#模範解答
N = int(input())
#これが唯一の事実データ
src = [tuple(map(int,input().split())) for i in range(N)]
 
INF = float('inf')
#ここ以降でかかれてあるcx,cyはあくまで頂上であると仮定しているだけで条件と合わない場合に不適切な座標となる。
for cx in range(0,101):
    for cy in range(0,101):
        tmph = None
        maxh = INF
        for x,y,h in src:
            if h > 0:
                tmp = h + abs(x-cx) + abs(y-cy)
                if tmph is None:
                    tmph = tmp
                else:
                    if tmp != tmph:
                        break
                if tmph > maxh:
                    break
            else:
                #ここでmaxhがtmphよりも小さくなってしまった場合、hは0だから頂点からのxとyの差の和がtmphはなければならないのに、それを下回っているため
                #データx,yは絶対的な値なのでcx,cyが間違っていることになる。それを判定するのが上のtmph > maxh の時となり
                maxh = min(maxh, abs(x-cx) + abs(y-cy))
                #ピラミッドが高さ１の頂点のみだった場合、h=1のデータが与えられていればいいがh=０しか与えられていない時のため
#                 if maxh == 1:
#                     tmph = 1
        else:
            for x,y,h in src:
                if max(tmph - abs(x-cx) - abs(y-cy), 0) != h:
                    break
            else:
                print(cx,cy,tmph)
                exit()
import sys

s = input()

if s = 'AAA' or s = 'BBB':
  print('No')
  sys.exit()
 
print('Yes')

### FIXED CODE ###

import sys

s = input()

if s == 'AAA' or s == 'BBB':
    print('No')
    sys.exit()

print('Yes')
S = list(input())
n = []
a = 0
for s in S :
	if s in ["A","T","G","C"] :
		a += 1
	else :
		n.append(a if a > 0 else 0)
		a = 0
print(max(n))

### FIXED CODE ###

S = list(input())
n = []
a = 0
for i,s in enumerate(S) :
	if s in ["A","T","G","C"] :
		a += 1
	else :
		n.append(a)
		a = 0
	
	if i+1 == len(S) :
		n.append(a)
		break
print(max(n))
W = input()
lett = list(W)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)


### FIXED CODE ###

mojiretsu = input()
lett = list(mojiretsu)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]
anslisT = [x for x in jud if jud.count(x) == 1]

if anslist == ['Yes']:
    print('Yes')
elif anslisT == ['Yes']:
    print('Yes')
else:
    print('No')
l = sorted.list(map(int,input().split()))
print(l[0]+l[1])

### FIXED CODE ###

l = sorted(list(map(int,input().split())))
print(l[0]+l[1])
N = int(input())
dp = [float('inf')] * (2*10**5+1)
dp[0] = 0

for i in range(1, N+1):
    dp[i] = min(dp[i-1], dp[i-6], dp[i-6**2], dp[i-6**3], dp[i-6**4], dp[i-6**5], dp[i-6**7],
                dp[i-9], dp[i-9**2], dp[i-9**3], dp[i-9**4], dp[i-9**5]) + 1

print(dp[N])


### FIXED CODE ###

N = int(input())
dp = [float('inf')] * (10**5+1)
dp[0] = 0

for i in range(1, N+1):
    dp[i] = min(dp[i-1], dp[i-6], dp[i-6**2], dp[i-6**3], dp[i-6**4], dp[i-6**5], dp[i-6**6],
                dp[i-9], dp[i-9**2], dp[i-9**3], dp[i-9**4], dp[i-9**5]) + 1

print(dp[N])
N, M, K = map(int, input().split())
A = list(map(int, input().split())) + [10 ** 10]
B = list(map(int, input().split())) + [10 ** 10]

check = 0
i = 0
while (K >= (check + A[i])) & (i < N):
    check += A[i]
    i += 1

cnt = i

for ii in range(i):
    check2 = sum(A[:(i - ii)])
    j = 0
    while (K >= check2 + B[j]) & (j < M):
        check2 += B[j]
        cnt_j = j
        j += 1
    cnt = max(cnt, i - ii + cnt_j + 1)

print(cnt)


### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0

for i in range(1, N):
    A[i] = A[i - 1] + A[i]
    if A[i] > K:
        A = A[:i]
        break
A = [0] + A
A = A[::-1]

for i in range(1, M):
    B[i] = B[i - 1] + B[i]
    if B[i] > K:
        B = B[:i]
        break
B = [0] + B

A_length = len(A)
B_length = len(B)

j = 0
for i in range(A_length):

    while j < B_length:
        if A[i] + B[j] <= K:
            j += 1
        else:
            break
    j -= 1

    ans = max(ans, A_length - (i + 1) + j)
print(ans)
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    z = S - x - y
    if 0 <= z and z <= k:
      count += 1
print(count)

### FIXED CODE ###

K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    z = S - x - y
    if 0 <= z and z <= K:
      count += 1
print(count)
N, M, X = map(int, input().split())
A = [*map(int, input().split())]

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(len(l) if len(l) < len(r) else len(r))


### FIXED CODE ###

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

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(len(l) if len(l) < len(r) else len(r))
import numpy as np
M=np.zeros((H,W))
H,W=[int(x) for x in input().split()]
h,w=[int(x) for x in input().split()]

for n in range(h):
    print
    M[n]=1
for m in range(w):
        M.T[m]=1
        
len(M[M==0])

### FIXED CODE ###

import numpy as np
H,W=[int(x) for x in input().split()]
h,w=[int(x) for x in input().split()]

M=np.zeros((H,W))

for n in range(h):
    print
    M[n]=1
for m in range(w):
        M.T[m]=1
        
print(len(M[M==0]))
X = int(input())

A_ = X//4+1
B_ = X//7+1

ans - 0
for a in range(A_):
  for b in range(B_):
    c = 4*a + 7*b
    if c > X:
      break
    if c == X:
      ans = 1
      break
if ans == 1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

X = int(input())

A_ = X//4+1
B_ = X//7+1

ans = 0
for a in range(A_):
  for b in range(B_):
    c = 4*a + 7*b
    if c > X:
      break
    if c == X:
      ans = 1
      break
if ans == 1:
  print("Yes")
else:
  print("No")
import math

N=int(input())
num=(N**0.5)//1+1
num=int(num)
for i in range(num,N+1):
    if N%i==0:
        x=i
        break

ans=int((math.log(x,10)+1)//1)
print(ans)

### FIXED CODE ###

def cal(N):
    num=(N**0.5)//1
    num=int(num)
    for i in range(num,0,-1):
       if N%i==0:
           k=int(N/i)
           x=len(str(k))
           break
    return x

print(cal(int(input())))
N, K = map(int, input().split())

elif len(list(range(1, N+1, 2))) >= K:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

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

if len(list(range(1, N+1, 2))) >= K:
    print('YES')
else:
    print('NO')
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[A[i]//2 for i in range(len(A))]

from fractions import gcd 
x=B[0]
for i in range(1,N):
  x=(x*B[i])//gcd(x,B[i])
lcm=x  
if all((lcm//b)%2==1 for b in B):
  Max=M//lcm
  if MaX%2==1:
    print((Max+1)//2)
  else:
    print((Max)//2)
else:
  print(0)


### FIXED CODE ###

K,X=map(int,input().split())
if K*500>=X:
  print("Yes")
else:
  print("No")
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

N = int(input())
a = [0] * (N+1)
for i in range(N):
    a[i] = list(map(int, input().split()))
dp = np.zeros((N+1, 3), dtype=np.int64)

for n in range(N):
    for i in range(3):
        for j in range(3):
            if i == j:
                continue
            dp[n+1][i] = max(dp[n+1][i], dp[n][j] + a[n][i])
ans = max(dp[N])

print(ans)

### FIXED CODE ###

# coding: utf-8
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())

A, B, C = 0, 0, 0 #最後に各活動を行った幸福度の和
for _ in range(N):
    a, b, c = map(int, input().split())
    A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c
ans = max(A, B, C)

print(ans)