Harryxun/stf_run huggingface dataset:
n = int(input())
a = [int(input()) for i in range(n)]
now = a[0]
cnt = 0
for i in range(n):
    cnt += 1
    now = a[now - 1]
    
    if a[now] == 2:
        
        print(cnt + 1)
        
        exit()
print("-1")

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
now = 0
cnt = 0
for i in range(n):
    #print(now)
    now = a[now] - 1
    cnt += 1
    if now == 1:
        
        print(cnt)
        
        exit()
print("-1")
a, b = (int(x) for x in input().split())
b = b / 2
result = a + new_b
print(result)

### FIXED CODE ###

a, b = map(int, input().split())
if 1 > a or b%2 != 0 or b > 100:
  SystemExit
print(int(a+b/2))
list=[chr(i) for i in range(97, 97+26)]
S=input()
A=[x for x in S]
A=set(A)
A=sorted(A)
for i in range(len(S)):
    if A[i] == list[i]:
        pass
    else:
        print(list[i])
        exit()
print("None")


### FIXED CODE ###

list=[chr(i) for i in range(97, 97+26)]
S=input()
S=set(S)
A=[x for x in S]
A=sorted(A)
if len(A)<26:
    A+="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
for i in range(26):
    if A[i] == list[i]:
        pass
    else:
        print(list[i])
        exit()
print("None")
import math
def P(p, q):
  return math.factorial(p)//math.factorial(p-q)

def cmb(p, q):
  return P(p, q)//math.factorial(q)

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

ans = []

x = 0
a = 1
if n-k == 1:
  b = 2
elif n-k > 1:
  b = cmb(n-k-1, 1)
else:
  b = 0
x = (2 + a * b)%(1000000007)
ans.append(x)

x = 0
if k == 1:
  a = 1
else:
  a = cmb(k-1, 1)
if n-k == 1:
  b = 1
elif n-k == 2:
  b = cmb(n-k-1, 1) * 2 + 1
else:
  b = cmb(n-k-1, 2) + cmb(n-k-1, 1) * 2 + 1
x = (a * b)%(1000000007)
ans.append(x)

#print(ans)

 
for i in range(3,k+1):
  x = 0
  a = cmb(k-1, i-1)#青玉の並べ方
  if n-k-1 < i-2:
    b = 0
  elif n-k-1 < i-1:
    b = cmb(n-k-1, i-2)
  elif n-k-1 < i-1:
    b = cmb(n-k-1, i-1) * 2 + cmb(n-k-1, i-2)
  else:
    b = cmb(n-k-1,i) + cmb(n-k-1, i-1) * 2 + cmb(n-k-1, i-2)
  x = (a * b)%(1000000007)
  ans.append(x)

for i in range(k):
  print(ans[i])

### FIXED CODE ###

import math
def P(p, q):
  return math.factorial(p)//math.factorial(p-q)

def cmb(p, q):
  return P(p, q)//math.factorial(q)

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

ans = []

x = 0
a = 1
if n-k == 1:
  b = 2
  x = (2 + a * b)%(1000000007)
elif n-k > 1:
  b = cmb(n-k-1, 1)
  x = (2 + a * b)%(1000000007)
else:
  x = 1
ans.append(x)

x = 0
if k == 1:
  a = 1
else:
  a = cmb(k-1, 1)
if n-k == 1:
  b = 1
elif n-k == 2:
  b = cmb(n-k-1, 1) * 2 + 1
elif n-k > 2:
  b = cmb(n-k-1, 2) + cmb(n-k-1, 1) * 2 + 1
else:
  b = 0
x = (a * b)%(1000000007)
ans.append(x)

#print(ans)

 
for i in range(3,k+1):
  x = 0
  a = cmb(k-1, i-1)#青玉の並べ方
  if n-k-1 < i-2:
    b = 0
  elif n-k-1 < i-1:
    b = cmb(n-k-1, i-2)
  elif n-k-1 < i:
    b = cmb(n-k-1, i-1) * 2 + cmb(n-k-1, i-2)
  else:
    b = cmb(n-k-1,i) + cmb(n-k-1, i-1) * 2 + cmb(n-k-1, i-2)
  x = (a * b)%(1000000007)
  ans.append(x)

for i in range(k):
  print(ans[i])
n = int(input())
A = [int(i) for i in input().split()]
input()
M = [int(i) for i in input().split()]

def solve(i, m):
    if m == 0:
        res = True
    elif i >= n:
        res = False
    else:
        res = solve(i+1, m) or solve(i+1, m-A[i])
    return res

for m in M:
    if solve(0, m):
        print('yes')
    else:
        print('no')


### FIXED CODE ###

n = int(input())
A = [int(i) for i in input().split()]
input()
M = [int(i) for i in input().split()]

def solve(i, m):
    if m == 0:
        return True
    if i >= n or m < 0:
        return False
    res = solve(i+1, m) or solve(i+1, m-A[i])
    return res

for m in M:
    if sum(A) < m:
        print("no")
    elif solve(0, m):
        print('yes')
    else:
        print('no')
*s, = input()

ans = "Yes"
for i in range(0, len(s), 2):
    if s[i] != "h" or s[i+1] != "i":
        ans = "No"
        break

print(ans)


### FIXED CODE ###

s = input()

if len(s)%2 == 0:
    x = len(s)//2
    if "hi"*x == s:
        print("Yes")
    else:
        print("No")
else:
    print("No")
print("Christmas"+" Eve"*(25-int(innput())))

### FIXED CODE ###

print("Christmas"+" Eve"*(25-int(input())))
a,b,c=input().split()
s=700
if a=='o' :
  s=s+100
if b=='o' :
  s=s+100
if c=='o' :
  s=s+100
print(s)

### FIXED CODE ###

a,b,c=input()
s=700
if a=='o' :
  s=s+100
if b=='o' :
  s=s+100
if c=='o' :
  s=s+100
print(s)
import numpy as np
import itertools
import sys
input = sys.stdin.readline  #文字列入力では注意！

N,C = map(int,input().split())
D = np.array([list(map(int,input().split()))for _ in range(C)], dtype=np.int64)
c = np.array([list(map(int,input().split()))for _ in range(N)], dtype=np.int64)
c0 = np.zeros(C)
c1 = np.zeros(C)
c2 = np.zeros(C)
for i in range(N):
    for j in range(N):
        if (i+j)%3 == 0:
            c0[c[i,j]-1] += 1
        if (i+j)%3 == 1:
            c1[c[i,j]-1] += 1
        if (i+j)%3 == 2:
            c2[c[i,j]-1] += 1
# c0~2はXの情報
lis = itertools.permutations([i for i in range(C)])
ans = float("inf")
for l0,l1,l2 in lis:    # l0~2はYの情報
    tmp = np.sum(D[:,l0]*c0+D[:,l1]*c1+D[:,l2]*c2, dtype=np.int64)
    ans = min(ans,tmp)
print(ans)


### FIXED CODE ###

import numpy as np
import itertools
import sys
input = sys.stdin.readline  #文字列入力では注意！

N,C = map(int,input().split())
D = np.array([list(map(int,input().split()))for _ in range(C)], dtype=np.int64)
c = np.array([list(map(int,input().split()))for _ in range(N)], dtype=np.int64)
c0 = np.zeros(C)
c1 = np.zeros(C)
c2 = np.zeros(C)
for i in range(N):
    for j in range(N):
        if (i+j)%3 == 0:
            c0[c[i,j]-1] += 1
        if (i+j)%3 == 1:
            c1[c[i,j]-1] += 1
        if (i+j)%3 == 2:
            c2[c[i,j]-1] += 1
# c0~2はXの情報
lis = itertools.permutations([i for i in range(C)],3)
ans = float("inf")
for l0,l1,l2 in lis:    # l0~2はYの情報
    tmp = np.sum(D[:,l0]*c0+D[:,l1]*c1+D[:,l2]*c2, dtype=np.int64)
    ans = min(ans,tmp)
print(ans)
def IslandsWar():
    n, m = map(int, input().split())
    a = [0 for _ in range(n-1)]
    INF = float('INF')
    for _ in range(m):
        x, y = map(int, input().split())
        for i in range(x-1, y-1):
            if abs(x-y) == 1:
                a[i] = INF
            else:
                a[i] += 1

    ans =  0
    count = 0
    status = False
    for i in range(n-2):
        if a[i] == INF:
            ans += 1
        elif a[i] < a[i+1]:
            status = True
        elif a[i] > a[i+1] and status:
            ans += 1
            count = 0
            status = False
        elif a[i] == a[i+1]:
            count += 1
        else:
            if count != 0:
                ans += 1
            count = 0
    if count != 0:
        ans += 1
    if a[-2] < a[-1]:
        ans += 1
    if a[-1] == INF:
        ans += 1
    print(ans)
            
if __name__ == "__main__":
    IslandsWar()


### FIXED CODE ###

def IslandsWar():
    n, m = map(int, input().split())
    a = [list(map(int,input().split())) for _ in range(m)]
    a.sort(key=lambda x: x[1])
    removes = [a[0][1]]

    for i, j in a[1:]:
        check = False
        for k in removes:
            if i < k:
                check = True
                break
        if not check:
            removes.append(j)
    print(len(removes))
            
if __name__ == "__main__":
    IslandsWar()
N , L =  map(int,input().split())

if L + N -1 >0:
    ans = ((L+N-1)-(L - 2))*((L+N-1)+(L - 2))/2
else:
    ans = ((L+N-1)-(L - 1)+ 1)*((L+N-1)+(L - 1))/2
    
print(int(ans))

### FIXED CODE ###

S = str(input())

flag = False
for i in range(1,4):
    if S[i-1] ==S[i]:
        flag = True

if flag:
    print('Bad')
else:
    print('Good')
a,b=map(int,input().splot())
if a%2==b%2:
  print((int)((a+b)/2))
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

a,b=map(int,input().split())
if a%2==b%2:
  print((int)((a+b)/2))
else:
  print("IMPOSSIBLE")
import math

d, g = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(d)]

for k,i in enumerate(lst):
    i.append((k+1)*100)
    i.append(i[2]*i[0]+i[1])

def calcurate(pt, count, g, lst):
    lst1 = list()
    for i in lst:
        if i[3] > g - pt:
            lst1.append(i + [i[2]])
        else:
            lst1.append(i + [i[3]/i[0]])
    lst1 = sorted(lst1, key = lambda x: -x[-1])
    ps = lst1[0]
    if ps[3] > g - pt:
        count += math.ceil((g - pt) / ps[2])
        return print(count)
    elif ps[3] == g - pt:
        return print(count + ps[0])
    else:
        calcurate(pt+ps[3], count+ps[0], g, lst1[1:])

calcurate(0,0,g,lst)

### FIXED CODE ###

r = int(input())
if r < 1200:
    print('ABC')
elif r < 2800:
    print('ARC')
else:
    print('AGC')
def main():
    if x =1:
        return 0
    else:
        return 1

main()


### FIXED CODE ###

x=int(input())

def main(x):
    if x ==1:
        return 0
    else:
        return 1
print(main(x))
#!/usr/bin/env python3                                                                        

class Node:
    def __init__(self, key):
        self.key = key
        self.right = None
        self.left = None

def insert(T, z):                     
    #initialization                                                                    
    y = None #parent of x                                                                  
    x = T

    #search                                                                            
    while(x!=None):
        y = x
        if(z.key < x.key):
            x = x.left
        else:
            x = x.right

    #insert                                                                            
    if(y==None):
	T = z
    elif(z.key < y.key):
        y.left = z
    else:
        y.right = z

    return T


def inorder_walk(node):
    if node.left:
        inorder_walk(node.left)
    print ('', node.key, end='')
    if node.right:
        inorder_walk(node.right)


def preorder_walk(node):
    print ('', node.key,end='')
    if node.left:
        preorder_walk(node.left)
    if node.right:
        preorder_walk(node.right)

if __name__ == '__main__':

    T = None
    num = int(input())

    for _ in range(num):
        cmd = input()
        if(cmd.startswith('i')):
            n = Node(int(cmd[7:]))
            T = insert(T, n)
        else:
            inorder_walk(T)
            print()
            preorder_walk(T)
            print()

### FIXED CODE ###

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
 
 
class Node(object):
    def __init__(self, key=None):
        self.key = key
        self.parent = None
        self.left = None
        self.right = None
 
 
def tree_insert(top, z):
    y = None
    x = top
    while isinstance(x, Node):
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right
    z.parent = y
    if y is None:
        top = z
    elif z.key < y.key:
        y.left = z
    else:
        y.right = z
    return top
 
 
def inorder_walk(node):
    if node.left:
        inorder_walk(node.left)
    print('', node.key, end='')
    if node.right:
        inorder_walk(node.right)
 
 
def preorder_walk(node):
    print('', node.key, end='')
    if node.left:
        preorder_walk(node.left)
    if node.right:
        preorder_walk(node.right)
 
 
n = int(stdin.readline())
 
top = None
for _ in range(n):
    cmd = stdin.readline()
    if cmd.startswith('i'):
        key = int(cmd[7:])
        #assert -2000000000 <= key <= 2000000000
        top = tree_insert(top, Node(key))
    else:
        inorder_walk(top)
        print()
        preorder_walk(top)
        print()
while 1:
    x = map(x, raw_input().split())
    x.sort()
    if sum(x) == 0:
        break
    else:
        print x[0],x[1]

### FIXED CODE ###

while 1:
    x = map(int, raw_input().split())
    x.sort()
    if sum(x) == 0:
        break
    else:
        print x[0],x[1]
H,W=map(int,input().split())
s=[list(input()) for i in range(H)]
dx=[0,0,1,-1]
dy=[-1,1,0,0]
L=[0]
k=0
#s[i][j]
#i in range(H)
#j in range(W)
def dfs(x,y):
    s[x][y]="."
    L[k]+=1
    for p in range(4):
        nx=x+dx[p]
        ny=y+dy[p]
        if 0<=nx<H and 0<=ny<W:
            if s[nx][ny]=="#":
                dfs(nx,ny)
for i in range(H):
    for j in range(W):
        if s[i][j]=="#":
            dfs(i,j)
            k+=1
            L.append(0)
if min(L[:-1])==1:
    print("No")
else:
    print("Yes")
#print(L[:-1])


### FIXED CODE ###

H,W=map(int,input().split())
s=[list(input()) for i in range(H)]
dx=[0,0,-1,1]
dy=[1,-1,0,0]
for i in range(H):
    for j in range(W):
        if s[i][j]=="#":
            flag=0
            for k in range(4):
                x=i+dx[k]
                y=j+dy[k]
                if 0<=x<H and 0<=y<W:
                    if s[x][y]=="#":
                        flag=1
            if flag==0:
                print("No")
                exit()
print("Yes")
s=list(input())
ls=len(s)
t=list(input())
lt=len(t)
clear=0
for i in range(ls-lt,-1,-1):
    ok=0
    for j in range(lt):
        if s[i+j]==t[j] or s[i+j]=='?':
            ok+=1
    if ok==lt:
        clear=1
        break
if clear==0:
    print('UNRESTORABLE')
else:
    for k in range(ls):
        if s[k]=='?':
            if k<i:
                s[k]='a'
            else:
                s[k]=t[k-i]
    print(''.join(s))

### FIXED CODE ###

s=list(input())
ls=len(s)
t=list(input())
lt=len(t)
can=[]
for i in range(ls-lt,-1,-1):
    ok=0
    for j in range(lt):
        if s[i+j]==t[j] or s[i+j]=='?':
            ok+=1
    if ok==lt:
        c=[0]*ls
        for k in range(ls):
            if s[k]=='?':
                if k<i or k>=i+lt:
                    c[k]='a'
                else:
                    c[k]=t[k-i]
            else:
                c[k]=s[k]
        can.append(''.join(c))
if len(can)==0:
    print('UNRESTORABLE')
else:
    print(sorted(list(can))[0])
n = int(input())
for i in range(n):
    p = list(map(float, input().split()))
    if p[2] == p[1]:
        print("YES" if p[4] == p[6] else "NO")
    else:
        print("YES" if (p[3] - p[1]) / (p[2] - p[0]) == (p[7] - p[5]) / (p[6] - p[4]) else "NO")

### FIXED CODE ###

n = int(input())
for i in range(n):
    p = list(map(float, input().split()))
    print("YES" if abs((p[3] - p[1]) * (p[6] - p[4]) - (p[7] - p[5]) * (p[2] - p[0])) < 1e-10 else "NO")
N = input("")
L = input("").split(" ")
suc = int(N)
min_ = 200001

for i in range(int(N)):
    if (L[i] == 1):
        continue
    if (min_ < L[i]):
        suc -= 1
        continue
    for j in range(i):
        if (L[j] < L[i]):
            suc -= 1
            break
    
print(suc)

### FIXED CODE ###

N = input("")
L = input("").split(" ")
suc = int(N)
min_ = 200001

for i in range(int(N)):
    if (L[i] == 1):
        min_= 1
        continue
    if (int(min_) < int(L[i])):
        suc -= 1
        continue
    if (int(min_) >= int(L[i])):
        min_ = L[i]
print(suc)
n11, n12, n13 = (input().split())
n21, n22, n23 = (input().split())
n31, n32, n33 = (input().split())
lines = [[n11,n12,n13],
         [n21,n22,n23],
         [n31,n32,n33],
         [n11,n21,n31],
         [n12,n22,n32],
         [n13,n23,n33],
         [n11,n22,n33],
         [n13,n22,n31]]
nums = {}
for i in range(int(input())):
  nums[input()] = 0
flag = False
for(l in lines):
  if l[0] in nums:
    if l[1] in nums:
      if l[2] in nums:
        flag = True
if flag:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

import math
s = input()
s = int(s)
s = s/2
s = math.ceil(s)
print(s)
N, i =int(input().split())
print(N-i+1)

### FIXED CODE ###

N, i =map(int,input().split())
print(N-i+1)
N = int(input())
N_half = round(N/2)
a =[]

for i in range(N_half):
    for j in range(N_half - i+1):
        if i * j == N:
            a.append([i,j])


sum=[]

for k in range(len(a)-1):
    sum.append(a[k][0] + a[k][1])

sum.sort
print(sum[0]-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)
n=int(input())
a=sorted(list(map(int,input().split())))
if n%3==0:
  d={}
  for ai in a:
    if ai not in d:
      d[ai]=a.count(ai)
  sa=list(set(a))
  if sa[0]^sa[1]==sa[2] and d[sa[0]]==d[sa[1]] and d[sa[0]]==d[sa[2]]:
    print('Yes')
    exit()
print('No')

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))
if n%3==0:
  d={}
  for ai in a:
    if ai not in d:
      d[ai]=a.count(ai)
      if len(d)==4:
        break
  sa=list(set(a))
  if len(sa)==3 and sa[0]^sa[1]==sa[2] and d[sa[0]]==d[sa[1]] and d[sa[0]]==d[sa[2]]:
    print('Yes')
    exit()
  if len(sa)==2 and 0 in d and 2*d[0]==max(d[sa[0]],d[sa[1]]):
    print('Yes')
    exit()

if n == a.count(0):
  print('Yes')
  exit()

print('No')
l, r = [int(i) for i in input().split()]

base = 2019
l_mod = l % base
r_mod = r % base

print(l_mod * (l_mod + 1))


### FIXED CODE ###

n = int(input())
A = [int(a) for a in input().split()]

x = 0
rains = [x]
for a in A:
    x = a - x
    rains.append(x)

diff = (rains[-1] - rains[0]) // 2
result = []
for i, x in enumerate(rains[:-1]):
    if i % 2 == 0:
        result.append(str((x + diff) * 2))
    else:
        result.append(str((x - diff) * 2))

print(' '.join(result))
m = int(input())
ans = 0
num = ""
for i in range(m):
    d, c = map(int, input().split())
    if d == 0:
        ans += c
    else:
        k = str(d) * c
        while len(k) != 1:
            k = str(int(k[0]) + int(k[1])) + k[2:]
            ans += 1
        num += k
while len(num) != 1:
    num = str(int(num[0]) + int(num[1])) + num[2:]
    ans += 1
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
m = int(input())
ans = 0
sum_num = 0
c_sum = 0
for i in range(m):
    d,c = map(int, input().split())
    sum_num += d*c
    c_sum += c
#合計に対して、9減らす行為が何回出来るか
print(c_sum-1 + ((sum_num-1)//9))
A, B, N = map(int, input().split(" "))

ans = 0
count = 0
num = int(N / B)
array = list(range(N, B * num - 1,-1))
# array2 = list(i for i in range(B * num, -1, -B))
# array.extend(array2)
# print(array)
for x in array:
#     print(x)
    if count > 1000000:
        break
    xb = x / B
    if xb < 1 and ans != 0:
        count += 1
#         print("continue")
        continue
    floor = int(A*xb) - A * int(xb)
    if ans < floor:
#         print(x)
#         print(x,count)
        count = 0
        ans = floor
    count += 1
print(ans)

### FIXED CODE ###

A, B, N = map(int, input().split(" "))
ans = 0
x = min(B-1,N)
floor = int(A*x/B) - A * int(x/B)
print(floor)
N, M = map(int, input().split())
keys = []

for _ in range(M):
    cost, _ = map(int, input().split())
    mask = 0
    for i in map(int, input().split()):
        mask |= (1 << (i - 1))
    keys.append((cost, mask))


allstate = (1 << N) - 1
dp = [float('inf')] * (1<<N)
dp[0] = 0

for cost, key_set in keys.items():
    for state in range(1<<N):
        if dp[state] == float('inf'): continue
        nstate = state | key_set
        dp[nstate] = min(dp[nstate], dp[state] + cost)

print(dp[-1] if dp[-1] != float('inf') else -1)


### FIXED CODE ###

N, M = map(int, input().split())
keys = []

for _ in range(M):
    cost, _ = map(int, input().split())
    mask = 0
    for i in map(int, input().split()):
        mask |= (1 << (i - 1))
    keys.append((cost, mask))


allstate = (1 << N) - 1
dp = [float('inf')] * (1<<N)
dp[0] = 0

for cost, key_set in keys:
    for state in range(1<<N):
        if dp[state] == float('inf'): continue
        nstate = state | key_set
        dp[nstate] = min(dp[nstate], dp[state] + cost)

print(dp[-1] if dp[-1] != float('inf') else -1)
S = input()

r = 1
 arr = [0]
 for c in S[::-1]:
   arr.append((arr[-1] + int(c) * r) % 2019)
   r *= 10
   r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*v(v-1)//2
print(ans)

### FIXED CODE ###

S = input()
r = 1
arr = [0]

for c in S[::-1]:
  arr.append((arr[-1] + int(c) * r) % 2019)
  r *= 10
  r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*(v-1)//2
print(ans)
dp = [[0] * 5 for _ in range(len(a) + 1)]

for i, x in enumerate(a):
    m = x % 2
    y = m + (x == 0) * 2
    z = 1 - m
    
    dp[i+1][0] = dp[i][0] + x
    dp[i+1][1] = min(dp[i][:2]) + y
    dp[i+1][2] = min(dp[i][:3]) + z
    dp[i+1][3] = min(dp[i][:4]) + y
    dp[i+1][4] = min(dp[i]) + x

print(min(dp[-1]))

### FIXED CODE ###

a = [int(input()) for _ in range(int(input()))]

dp = [[0] * 5 for _ in range(len(a) + 1)]

for i, x in enumerate(a):
    y = x % 2 + (x == 0) * 2
    z = (x + 1) % 2
    
    dp[i+1][0] = min(dp[i][0:1]) + x
    dp[i+1][1] = min(dp[i][0:2]) + y
    dp[i+1][2] = min(dp[i][0:3]) + z
    dp[i+1][3] = min(dp[i][0:4]) + y
    dp[i+1][4] = min(dp[i][0:5]) + x

print(min(dp[-1]))
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
n = int(input())
A = input().split()
m = [int(a) for a in A]
ans = 0
for i in range(n):
    B = m[:]
    B.pop(i)
    cand = gcd_list(B)
    if cand > ans:
        ans = cand
print(ans)

### FIXED CODE ###

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

N=int(input())
A=[int(i) for i in input().split()]
X=[0 for i in range(N)]
Y=[0 for i in range(N)]
for i in range(1,N):
    X[i]=gcd(X[i-1],A[i-1])
for i in range(N-1)[::-1]:
    Y[i]=gcd(Y[i+1],A[i+1])
Z=[gcd(X[i],Y[i]) for i in range(N)]
print(max(Z))
a, b = map(int,iput().split(" "))
print("{}".format((a+b-1)/b))

### FIXED CODE ###

a, b = map(int,input().split(" "))
print("{}".format(int((a+b+2-1)/2)))
import math

a, b, c, d = map(int, input().split())
lcm_num = c*d / math.gcd(c, d)

def f(x):
    return x - x//c - x//d + x//lcm_num

print(f(b) - f(a-1))

### FIXED CODE ###

import fractions

def f(x, c, d):
    lcm_num = c*d // fractions.gcd(c, d)
    return x - x//c - x//d + x//lcm_num

a, b, c, d = map(int, input().split())
print(int(f(b, c, d) - f(a-1, c, d)))
n, m = map(int, input().split())
adj = [[] for _ in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    adj[a].append(b)
    adj[b].append(a)

from collections import deque
q = deque([0])
dist = [-1]*n
ans = [0]*n

while q:
    now = q.popleft()
    for to in adj[now]:
        if dist[to] != -1: continue
        ans[to] = now 
        dist[to] = dist[now] + 1
        q.append(to)

print("Yes")
for i in range(1,n):
    print(ans[i]+1)


### FIXED CODE ###

n, m = map(int ,input().split())
 
adj = [[] for _ in range(n)]
 
for i in range(m):
    a, b = map(int, input().split())
    a-=1
    b-=1
    adj[a].append(b)
    adj[b].append(a)
 
from collections import deque
q = deque()
 
dist = [-1] * n
ans = [0] * n
 
q.append(0)
while len(q) != 0:
    now = q.popleft()
    for to in adj[now]:
        if dist[to] != -1:continue
        dist[to] = dist[now] + 1
        q.append(to)
        ans[to] = now
 
print("Yes")
for i in range(1, n):
    print(ans[i] + 1)
n,m=map(int,input().split())
a=[]
for _ in range(m):
    a.append(int(input()))
ans=1
a.sort()
def func(n):
    if n<=3:
        return max(1,n)
    else:
        return func(n-1)+func(n-2)
ps=-1
a.append(n+1)
for ai in a:
    c=ai-ps-2
    ps=ai
    if c<0:
        print(0)
        exit()
    c=func(c)
    ans*=c
    ans%=10**9+7

print(ans%(10**9+7))

### FIXED CODE ###

n,m=map(int,input().split())
a=[]
for _ in range(m):
    a.append(int(input()))
ans=1
a.sort()
d={0:1,1:1,2:2,3:3,4:5,5:8,6:13,99500:49759705584609,99501:49760296517401}
def func(n):
    if n in d:
        return d[n]
    else:
        v = (func(n-1)+func(n-2))%(10**9+7)
        d[n]=v
        return v
ps=-1
a.append(n+1)
for ai in a:
    c=ai-ps-2
    ps=ai
    if c<0:
        print(0)
        exit()
    c=func(c)
    ans*=c
    ans%=10**9+7

print(ans%(10**9+7))
from math import pi

r=int(input())
print(pi*r**2)


### FIXED CODE ###

from math import pi
r = float(input())
a = pi*r*r
b = 2*pi*r
print(a,b)