Harryxun/stf_run huggingface dataset:
n,m = map(int,input().split())
ai = [int(i) for i in input().split()]

for i in range(n):
    ai[i] = ai[i]%m

a = [0]*(n+1)
tmp = 0

for i in range(n):
    tmp += ai[i]
    tmp %= m
    a[i+1] = tmp
    
ans = 0

li = [0]*(m)

for i in range(n+1):
    ans += li[a[i]]
    li[a[i]] += 1

print(ans)


### FIXED CODE ###

n,m = map(int,input().split())
ai = [int(i) for i in input().split()]

for i in range(n):
    ai[i] = ai[i]%m

a = [0]*(n+1)
tmp = 0

for i in range(n):
    tmp += ai[i]
    tmp %= m
    a[i+1] = tmp
    
ans = 0

#li = [0]*(m)

d = dict()

for i in range(n+1):
    if a[i] in d:
        ans += d[a[i]]
        d[a[i]] += 1
    else:
        d[a[i]] = 1
    #print(ans,d)

print(ans)
A, B, C = map(lambda x: int(x), input().split(" "))
if A=B and B=C:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

A, B, C = map(lambda x: int(x), input().split(" "))
if A is B and B is C:
  print("Yes")
else:
  print("No")
vN, K = list(map(int, input().split()))
links = [list(map(int, input().split())) for _ in range(N-1)]

def perm(a, b):
    s = 1
    for i in range(a-b+1, a+1):
        s *= i
    return s

if N == 1:
    print(K)
elif K == 1:
    print(0)
else:
    mod = 1000000007
    d = {}
    for a, b in links:
        if a in d:
            d[a].append(b)
        else:
            d[a] = [b]
        if b in d:
            d[b].append(a)
        else:
            d[b] = [a]
    for j in d[1]:
        d[j].remove(1)
    ans = K * perm(K - 1, len(d[1]))
    root = d[1]
    a = K - 2
    while True:
        children = []
        for i in root:
            for j in d[i]:
                d[j].remove(i)
            b = len(d[i])
            if a < b:
                print(0)
                break
            if b == 0:
                continue
            ans *= perm(a, b)
            children.extend(d[i])
        else:
            if children == []:
                print(ans % mod)
                break
            root = children
            continue
        break


### FIXED CODE ###

N, K = list(map(int, input().split()))
l = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    l[a].append(b)
    l[b].append(a)

deg1 = [0] * (N + 1)
deg2 = [0] * (N + 1)
history = [True] * (N + 1)
stack = [1]
ans = 1

while stack:
    node = stack.pop()
    ans *= K - deg1[node] - deg2[node]
    ans %= 1000000007
    history[node] = False
    for child in l[node]:
        if history[child]:
            deg1[child] += 1
            deg2[child] += deg1[node]
            deg1[node] += 1
            stack.append(child)
            
print(ans)
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    try:

        N = int(input())
        A = list(map(int, input().split()))
        ans = reduce(mul, A)
        if ans > 10 ** 18:
            print(-1)
        else:
            print(ans)
    except:
        print(-1)

### FIXED CODE ###

import numpy as np;




if __name__ == '__main__':
    a, b = map(int, input().split())
    print(a*b)
A,B = list(map(int,input().split()))
ans=[0]*3
a[0]=A+B
a[1]=A-B
a[2]=A*B
print(max(a))

### FIXED CODE ###

A,B = list(map(int,input().split()))
a=[0]*3
a[0]=A+B
a[1]=A-B
a[2]=A*B
print(max(a))
input(n)
print(n**3)

### FIXED CODE ###

x = int(input())
print(x**3)
m1=int(input())
d1=int(input())
m2=int(input())
d2=int(input())
if m1+1==m2:
  print(1)
else:
  print(0)

### FIXED CODE ###

m1,d1=map(int,input().split())
m2,d2=map(int,input().split())

if m1+1==m2:
  print(1)
else:
  print(0)
#insertion
n=int(input())
s=input()
count=1
countlist=[]
s=s+"X"
for i  in range(n):
    if s[i]==s[i+1]:
        count+=1
    else:
        if s[i]=="(":
            countlist.append((count,"L"))
        else:
            countlist.append((count,"R"))
        count=1

if len(countlist)%2==0 and countlist[0][1]=="L":
    pass
elif len(countlist)%2!=0 and countlist[0][1]=="L":
    countlist.append((countlist[-1][0],"R"))
elif len(countlist)%2==0 and countlist[0][1]=="R":
    countlist.append(countlist[-1][0],"R")
    countlist=[(countlist[0][0],"L")]+countlist
elif len(countlist)%2!=0 and countlist[0][1]=="R":
    countlist=[(countlist[0][0],"L")]+countlist

ans=""
for i in range(0,len(countlist),2):
    x=max(countlist[i][0],countlist[i+1][0])
    ans=ans+"("*x+")"*x
print(ans)
    

### FIXED CODE ###

#insertion
n=int(input())
s=input()
count=1
Llist=[]
Rlist=[]
s=s+"X"
for i  in range(n):
    if s[i]==s[i+1]:
        count+=1
    else:
        if s[i]=="(":
            Llist.append(count)
        else:
            Rlist.append(count)
        count=1
#LのがRよりもつよい
if s[0]==")":
    Llist.insert(0,0)
if s[-2]=="(":
    Rlist.append(0)

Lsum=0
Rsum=0
for i in range(len(Llist)):
    Lsum+=Llist[i]
    Rsum+=Rlist[i]
    if Lsum>=Rsum:
        pass
    elif Lsum<Rsum:
        Llist[0]+=(Rsum-Lsum)
        Lsum+=(Rsum-Lsum)
if Lsum!=Rsum:
    Rlist[-1]+=(Lsum-Rsum)
anstr=""
for i in range(len(Llist)):
    a,b=Llist[i],Rlist[i]
    anstr+="("*a
    anstr+=")"*b
print(anstr)
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

nums = {}
nums[1] = 2
nums[2] = 5
nums[3] = 5
nums[4] = 4
nums[5] = 5
nums[6] = 6
nums[7] = 3
nums[8] = 7
nums[9] = 6

dp = [0]*(N+1)

for i in range(1, N+1):
    make = True
    for a in A:
        if i-a >= 0:
            dp[i] = max(1, dp[i-nums[a]]+1)
            make = False
    if make:
        dp[i] = -float('inf')

ans = ""
i = N
while i > 0:
    for a in A:
        if dp[i]-1 == dp[i-nums[a]]:
            ans += str(a)
            i = i-nums[a]
            break
print(ans)


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

nums = {}
nums[1] = 2
nums[2] = 5
nums[3] = 5
nums[4] = 4
nums[5] = 5
nums[6] = 6
nums[7] = 3
nums[8] = 7
nums[9] = 6

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

for i in range(N+1):
    for a in A:
        if i-nums[a] >= 0:
            dp[i] = max(dp[i], dp[i-nums[a]]+1)

ans = ""
i = N
while i > 0:
    for a in A:
        if i >= nums[a] and dp[i]-1 == dp[i-nums[a]]:
            ans += str(a)
            i = i-nums[a]
            break
print(ans)
import sys

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7

def P(m, n):
    num = 1
    for i in range(n):
        num = (num*(m-i)) % INF
    return num


n, k = list(map(int, sys.stdin.readline().split()))
graph = [dict() for i in range(n)]
for i in range(n):
    graph[i]["eda"]=[]
for i in range(n - 1):
    a, b = list(map(int, sys.stdin.readline().split()))
    graph[a - 1]["eda"].append(b - 1)
    graph[b - 1]["eda"].append(a - 1)
ans = 1
check = [False] * n
stack = [0]
ans = 1
while len(stack) > 0:
    x = stack.pop()
    check[x] = True
    count = 0
    for i in graph[x]["eda"]:
        if not check[i]:
            count += 1
            stack.append(i)
    if x == 0:
        temp = P(k - 1, count)
        ans = (ans * temp) % INF
    else:
        temp = P(k - 2, count)
        ans = (ans * temp) % INF

print((ans * k) % INF)


### FIXED CODE ###

N, A, B = list(map(int,input().split()))

print(min(A*N, B))
a,b,c=map(int,input().split())
print((a+b)*h/2)

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
text = input()
N, W = text.split("\n")[0], text.split("\n")[1]

N = int(N[0])
W = [int(i) for i in W]

ans = 100*100

for T in range(N):
  ans_tmp = abs(sum(W[:T]) - sum(W[T:]))
  if ans_tmp < ans:
    ans = ans_tmp

print(ans)


### FIXED CODE ###

n_text = input()
w_text = input()

N = int(n_text)
W = w_text.split()

W = [int(i) for i in W]

ans = 100 * 100

for T in range(N):
  ans_tmp = abs(sum(W[:T]) - sum(W[T:]))
  if ans_tmp < ans:
    ans = ans_tmp

print(ans)
import math
N,X = map(int,input().split())

x = list(map(int,input().split()))
st = []
x.append(X)

x.sort()

gcd = x[0]

for i in range(N):
    gcd = math.gcd(gcd,x[i+1]-x[i])
    st.append(x[i+1]-x[i])
st.sort()
for v in st:
    if not v % gcd:
        print(v)
        break


### FIXED CODE ###

import fractions
N,X = map(int,input().split())

x = list(map(int,input().split()))
st = []
x.append(X)

x.sort()

gcd = 0

for i in range(N):
    if i == 0:
        gcd = x[i+1]-x[i]
    else:
        gcd = fractions.gcd(gcd,x[i+1]-x[i])
    st.append(x[i+1]-x[i])
print(gcd)
N, K = map(int,input().split())
ans = 0

ev = 0
ev2 = 0
od = 0
if K % 2 == 1:
    print((N//K)**3)
else:
    ans = N//K
    for i in range(1,N+1):
        if i % (K//2):
            t += 1
    print(ans + t**3)

### FIXED CODE ###

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

ev = 0
ev2 = 0
od = 0
if K % 2 == 1:
    print((N//K)**3)
else:
    ans = N//K
    for i in range(1,N+1):
        if i % K == (K//2):
            ev += 1
    print(ans**3 + ev**3)
import collections

n = int(input())
A = map(int, input().split())
c = collections.Counter(A)
if n % 2 == 0:
    for k, v in c.items():
        if v % 2 != 0:
            break
    else:
        print(int((2 ** (n / 2)) % (10 ** 9 + 7)))
else:
    if c[0] != 1:
        print(0)
    else:
        for k, v in c.items():
            if v % 2 != 0 and k != 0:
                print(0)
                break
        else:
            print(int((2 ** ((n - 1) / 2)) % (10 ** 9 + 7)))


### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
if n % 2 == 0:
    l = n ** 2
else:
    l = (n - 1) * (n + 1)
if sum(A) == l // 2:
    print(2 ** (n // 2) % (10 ** 9 + 7))
else:
    print(0)
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholString == wholeString[::-1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholeString == wholeString[::-1]:
  print("Yes")
else:
  print("No")
from collections import deque

n, q = map(int, input().split())
G = [[] for yy in range(n)]
count = [0]*n
flag=[False]*n
stack = deque([0])

for _ in range(n-1):
  a, b = map(int, input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
for _ in range(q):
  p, x = map(int, input().split())
  count[p-1] += x

stack.append(0)
while stack:
  v = stack.pop()
  flag[v] = True
  for e in G[v]:
    if flag[e]:
      continue
    count[e] += count[v]
    stack.append(e)

print(*count)

### FIXED CODE ###

a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')
import math

A, B = [i for i in input().split()]
print(math.floor(int(A)*Decimal(B)))


### FIXED CODE ###

from decimal import *
A,B = input().split()
print(int(int(A)*Decimal(B)))
N = int(input())
F = []

for _ in range(N):
    F.append(list(input().split()))

P = []

for _ in range(N):
    P.append(list(map(int, input().split())))

c = [0] * 10
ans = -1000000000
tmp = 0

for i in range(1, 1024):
    i = format(i, 'b')
    i = str(i)
    i = i.zfill(10)
    i = list(i)
    for j in range(N):
        for k in range(10):
            if F[j][k] == i[k] == '1':
                c[j] += 1
    for j in range(N):
        tmp += P[j][c[j]]
    if tmp > ans:
        ans = tmp
    tmp = 0
    c = [0] * 10

print(ans)

### FIXED CODE ###

N = int(input())
F = []
P = []
for _ in range(N):
    F.append(list(map(int, input().split())))
for _ in range(N):
    P.append(list(map(int, input().split())))

ans = -1000000000


for i in range(1, 1024):
    tmp = 0
    c = [0] * N
    ii = list(str(format(i, 'b')).zfill(10))
    for j in range(N):
        for k in range(10):
            if str(F[j][k]) == ii[k] and ii[k] == '1':
                c[j] += 1
    for j in range(N):
        tmp += P[j][c[j]]
    if tmp > ans :
        ans = tmp

print(ans)
S = input()
print("Yes" len(set(S)) ==2 else "No")

### FIXED CODE ###

S = input()
print("Yes" if len(set(S)) ==2 else "No")
H,W = map(int,input().split())
S = ["."*(W+2)]+["."+input()+"." for h in range(H)]+["."*(W+2)]

for h in range(1,H+1):
  for w in range(1,W+1):
    if S[h][w]=="#" and S[h-1][w]=="." and S[h+1][w]=="." and S[h][w-1]=="." and S[h][w+1]==".":
      print("No")
      exit()
      
print("Yes")


### FIXED CODE ###

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

if a<=b:
  print(a)
else:
  print(a-1)
while True:
  x,y =map(int, input().split())
  if x==0 and y==0:
    break
  if x>y:
    print(y,x)
  else:
     print(x,y)


### FIXED CODE ###

c = 1
while True:
 x = int(input())
 if x ==0:
   break
 print("Case ",c,": ",x,sep="")
 c += 1
s=input()

if s =="Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else s == "Rainy":
    print("Sunny")

### FIXED CODE ###

s=input()

if s =="Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
elif s == "Rainy":
    print("Sunny")
def comb(n, r):
  if n < r:
    return 0
  r = min(r, n - r)
  if n == 0 or r == 0:
    return 1
  return (n - r + 1) * comb(n, r - 1) // r

N, K = list(map(int, input().split()))
for i in range(K):
  print(comb(N - K + 1, i + 1) * comb(K - 1, i) % (10 ** 9 + 7))

### FIXED CODE ###

def comb(n, r):
  if n < 0 or r < 0:
    raise ValueError
  r = min(r, n - r)
  if n == 0 or r == 0:
    return 1
  return (n - r + 1) * comb(n, r - 1) // r

N, K = list(map(int, input().split()))
for i in range(K):
  if N - K + 1 < i + 1:
    print('0')
    continue
  print(comb(N - K + 1, i + 1) * comb(K - 1, i) % (10 ** 9 + 7))
import bisect
N,M=(int(x) for x in input().split())
As=sorted([int(x) for x in input().split()])
BC=[]

result=0
for _ in range(M):
    BC.append([int(x) for x in input().split()])

BC=sorted(BC, key=lambda x: x[1],reverse=True)

for b,c in BC:
    if As[b-1]<=c:
        result+=c*b
        As=As[b:]
    else:
        pos=bisect.bisect_left(As,c)
        result+=c*pos
        As=As[pos:]
        break
        
print(result+sum(As))


### FIXED CODE ###

import bisect
N,M=(int(x) for x in input().split())
As=sorted([int(x) for x in input().split()])
BC=[]

result=0
for _ in range(M):
    BC.append([int(x) for x in input().split()])

BC=sorted(BC, key=lambda x: x[1],reverse=True)
now=0
for b,c in BC:
    if now+b-1<=len(As)-1:
        if As[now+b-1]<=c:
            result+=c*b
            now+=b
        else:
            pos=bisect.bisect_left(As[now:],c)
            result+=c*pos
            now+=pos
            break
    else:
        if As[-1]<=c:
            result+=c*(N-now)
            As=[]
        else:
            pos=bisect.bisect_left(As[now:],c)
            result+=c*pos
            now+=pos
        break
        
print(result+sum(As[now:]))
#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/agc040/tasks/agc040_a

MAX_INT = 100000
s_txt = input()

MIN_V = 1000000

def func(my_suretu, my_s_txt, min_v):
    #print('func(', my_suretu, my_s_txt, min_v, ')')

    now_sum = sum(my_suretu)
    # print(now_sum)
    if (now_sum >= min_v):
        return min_v

    if (len(my_s_txt) == 0):
        if (now_sum < min_v):
            min_v = now_sum
        return min_v
    else:
        next_my_s_txt = my_s_txt[1:]

    for v in range(0, MAX_INT):
        new_min_v = min_v
        if (len(my_suretu)==0):
            new_min_v = func(my_suretu + [v], next_my_s_txt, min_v)
        elif (((my_s_txt[0] == '>') and (my_suretu[-1] > v)) or 
            ((my_s_txt[0] == '<') and (my_suretu[-1] < v))):
            #print(my_suretu[-1], my_s_txt[0], v)
            new_min_v = func(my_suretu + [v], next_my_s_txt, min_v)
        if (new_min_v < min_v):
            min_v = new_min_v
        elif ((new_min_v == min_v) and (new_min_v != MIN_V)):
            break

    return min_v
        
min_v = MIN_V
for v in range(0, MAX_INT):
    new_min_v = func([v], s_txt, min_v)
    if (new_min_v < min_v):
        min_v = new_min_v
    elif ((new_min_v == min_v) and (new_min_v != MIN_V)):
        break

print(min_v)



### FIXED CODE ###

#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/agc040/tasks/agc040_a

s = input()
a = [0] * (len(s) + 1)

for i in range(0, len(s)):
    if (s[i] == '<'):
        a[i+1] = a[i] + 1
for i in range(len(s)-1, -1, -1):
    if (s[i] == '>'):
        a[i] = max(a[i], a[i+1]+1)
#print(a)
print(sum(a))
n = int(input())

s = []
for i in range(n):
	S,P=input().split()
    s.append(S,int(P),i+1)

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])

### FIXED CODE ###

n = int(input())

s = []
for i in range(n):
	S,P=input().split()
	s.append([S,-int(P),i+1])

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(0)
k = 0
if(n%2==1):
  k = (n-1)/2
else:
  k = n//2
  for i in range(n):
    if(i%2==0):
      b[k+i]==a[i]
    else:
      b[k-i]==a[i]
print(b)
  
  


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(0)
k = 0
if(n%2==1):
  k = (n-1)//2
  m = -1
else:
  k = n//2
  m = 1
for i in range(n):
  if(i%2==0):
    b[k+m*i//2]=a[i]
  else:
    b[k-m*(i+1)//2]=a[i]
ans = ""
for i in range(n):
  ans += str(b[i])+" "
print(ans)
N, K = map(int, input().split())
for i in range(1,K+1):
  r = 1
  for j in range(1, i+1):
    r = (r * (N-K+2-j))
  for j in range(1, i+1):
    r = int(r / j)
  for j in range(1, i):
    r = (r * (K-j))
  for j in range(1, i):
    r = int(r / j)
  print(r % 1000000007)


### FIXED CODE ###

N, K = map(int, input().split())
a = N-K+1
print(a)
for i in range(1,K):
  a = int(a * (N-K+1-i) * (K-i) // i // (i+1))
  print(a % 1000000007)
import numpy as np

N = int(input())
A = list(map(int, input().split()))

p = len(format(max(A), 'b'))
digit = ['0' + str(p) + 'b'] * N
S = list(map(format, A, digit))
X = np.array([[int(c) for c in s] for s in S])
#print(X)
r = np.sum(X, 0)
#print(r)
r = r * (N - r)
#print(r)

res = 0
for j in range(p):
  res += r[j] * (2 ** (p-1-j))

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

### FIXED CODE ###

a1, a2, a3 = map(int, input().split())
if a1 + a2 + a3 >= 22:
  print('bust')
else:
  print('win')
n = int(input())

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

j = 100000000000000000

ans = 1

for i in range(n):
    ans *= An[i]

if ans <= s:
    print(ans)
else :
    print('-1')


### FIXED CODE ###


n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

from collections import Counter
n = int(input())
prime_list = prime_factorize(n)
if n == 1:
    print(1)
    break

cnt = Counter(prime_list)
cnt_values = list(cnt.values())
value_list = [range(i + 1) for i in cnt_values]
iter_list = list(value_list[0])
iter_list = [[i] for i in iter_list]
for v_list in value_list[1:]:
    tmp = []
    for v in v_list:
        for i in iter_list:
            tmp.append(i + [v])
    iter_list = tmp
    
key_list = list(cnt.keys())
ans = n - 1
mod = 2 * n
for i_list in iter_list:
    tmp = 1
    for key, value in zip(key_list, i_list):
        tmp = tmp * pow(key, value)
    if tmp == 1:
        continue
    if tmp * (tmp - 1) % mod == 0:
        ans = min(ans, tmp - 1)
    if tmp * (tmp + 1) % mod == 0:
        ans = min(ans, tmp)
print(ans)    

### FIXED CODE ###

import math

def gcd_ext(a, b):
    x, y, lastx, lasty = 0, 1, 1, 0
    while b != 0:
        q = a // b
        a, b = b, a % b
        x, y, lastx, lasty = lastx - q * x, lasty - q * y, x, y
    return (lastx, lasty)

n = int(input())
divisor_list = []
n *= 2
for x in range(2, int(n ** 0.5) + 1):
    if n % x == 0:
        divisor_list.append([x, n // x])
ans = n - 1
for m1, m2 in divisor_list:
    if math.gcd(m1, m2) != 1:
        continue
    p, q = gcd_ext(m1, m2)
    tmp = (-1 * m1 * p) % (m1 * m2)
    ans = min(tmp, ans)
    tmp = (-1 * m2 * q) % (m1 * m2)
    ans = min(tmp, ans)
print(ans)
N=int(input())
h=list(map(int,input().split()))
s=0
mini=100
def garden(N,h,s,mini):
  p=[]
  a=0
  b=0
  size=0
  for i in range (N):
    if mini>h[i]:
      mini=h[i]
    if i!=N-1:
      if h[i]>h[i+1]:
        p.append(h[i])
        a+=h[i]
        size+=1
    if i!=N-1 and i!=0:
      if h[i]<h[i+1] and (h[i]-h[i-1])*(h[i+1]-h[i])<=0:
        p.append(h[i])
        b+=h[i]
        size+=1
    if i==N-1:
      if h[i-1]<h[i]:
        p.append(h[i])
        a+=h[i]
        size+=1
  s+=a
  s-=b
  flag=0
  for j in range (1,size-2):
    if (p[j]-p[j-1])*(p[j+1]-p[j])>0:
      flag=1
  if flag==1:
    garden(size,p,s,mini)
  if s==0 and h[0]!=0:
    s+=1
  print(s)
  
garden(N,h,s,mini)

### FIXED CODE ###

N=int(input())
h=list(map(int,input().split()))
s=h[0]
for i in range (1,N):
  if h[i]>h[i-1]:
    s+=(h[i]-h[i-1])
print(s)
N,A,B,C,D = map(int,input().split())
S = input()
right = max(C,D)-1
r = min(C,D)-1

if '##' in S[A-1:C-1] or '##' in S[B-1:D-1]:
  print('No')
else:
  if C < D:
  	print('Yes')
    break
  else:
    if '...' in S[B-1:right]:
      print('Yes')
      break
    else:
      if len(S[A-1:right])<=6:
        print('Yes')
        break
      print('No')


### FIXED CODE ###

N,A,B,C,D = map(int,input().split())
S = input()
right = max(C,D)
r = min(C,D)-1

if '##' in S[A-1:C] or '##' in S[B-1:D]:
  print('No')
else:
  if C < D:
  	print('Yes')
  else:
    if '...' in S[B-2:D+1]:
      print('Yes')
    else:
      if len(S[A-1:right])<=6:
        if S[A-1:right].count('#')==2:
          print('No')
        else:
          print('Yes')
      else:
        print('No')
import numpy as np
H,W,M=map(int, input().split())
hl=np.array([0 for i in range(H+1)])
wl=np.array([0 for i in range(W+1)])
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
hmax=[]
wmax=[]
for i in range(len(hl))l:
    if hl[i]==a:
        hmax.append(i)
for i in range(len(wl))l:
    if wl[i]==a:
        wmax.append(i)
# hmax=np.where(hl == hl.max())[0]
# wmax=np.where(wl == wl.max())[0]
bl=False
if len(hmax)*len(wmax)>M:
    bl=True
else:
    for x in hmax:
        for y in wmax:
            if [x,y] not in ms:
                bl=True
                break
        if bl:
            break
if bl:
    print(a+b)
else:
    print(a+b-1)

### FIXED CODE ###


H,W,M=map(int, input().split())
hl=[0 for i in range(H+1)]
wl=[0 for i in range(W+1)]
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
hmax=[]
wmax=[]
s=0
for x in ms:
    if  hl[x[0]]==a and wl[x[1]]==b:
        s+=1
c=hl.count(a)
d=wl.count(b)
if s<c*d:
    print(a+b)
else:
    print(a+b-1)
N = int(input())
A = [int(_) for _ in input().split()]

ma = sorted(x for x in A if x < 0)
pa = sorted(x for x in A if x >= 0)

# print(ma, pa)

if len(ma) % 2 == 0:
    result = -sum(ma) + sum(pa)
else:
    x = min(-ma[-1], pa[0])
    result = -sum(ma) + sum(pa) - x * 2

print(result)
   

### FIXED CODE ###

N = int(input())
A = [int(_) for _ in input().split()]

ma = sorted(x for x in A if x < 0)
pa = sorted(x for x in A if x >= 0)

# print(ma, pa)

if len(ma) % 2 == 0:
    result = -sum(ma) + sum(pa)
else:
    x = -ma[-1]
    if len(pa):
        x = min(x, pa[0])
    result = -sum(ma) + sum(pa) - x * 2

print(result)
nums = input()
numlist = list(nums.split(' '))
for i in numlist:
  if i == '0':
    print i


### FIXED CODE ###

# coding: utf-8
# Your code here!
x=input().split()



if(x[0]=="0"):
    print(1)
elif(x[1]=="0"):
    print(2)
elif(x[2]=="0"):
    print(3)
elif(x[3]=="0"):
    print(4)
elif(x[4]=="0"):
    print(5)