Harryxun/stf_run huggingface dataset:
h,w = map(int,input().split())
lis = []
for i in range(h):
  lis.append(list(map(int,input().split())))
cou = 0
ans = []
for i in range(h):
  for j in range(w):
    if lis[i][j] % 2 == 1:
      if j != w-1:
        ans.append([str(i+1),str(j+1),str(i+1),str(j+2)])
        lis[i][j]-=1
        lis[i][j+1]+= 1
        cou += 1
      else:
        ans.append([i+1,j+1,i+2,j+1])
        lis[i][j]-=1
        lis[i+1][j]+= 1
        cou += 1
print(cou)
for i in range(len(ans)):
  print(" ".join(ans[i]))

### FIXED CODE ###

h,w = map(int,input().split())
lis = []
for i in range(h):
  lis.append(list(map(int,input().split())))
cou = 0
ans = []
for i in range(h):
  for j in range(w):
    if lis[i][j] % 2 == 1:
      if j != w-1:
        ans.append([str(i+1),str(j+1),str(i+1),str(j+2)])
        lis[i][j]-=1
        lis[i][j+1]+= 1
        cou += 1
      else:
        if i != h-1:
          ans.append([str(i+1),str(j+1),str(i+2),str(j+1)])
          lis[i][j]-=1
          lis[i+1][j]+= 1
          cou += 1
print(cou)
for i in range(len(ans)):
  print(" ".join(ans[i]))
r, c = [int(i) for i in input().split()]

data = []
sum_row = [0] * (c + 1)

for ri in range(r):
    data.append([int(i) for i in input().sprit()])
    data[ri].append(sum(data[ri]))
    print(" ".join([str(d) for d in data[ri]]))
    for ci in range(c + 1):
        sum_row[ci] += data[ri][ci]
        
print(" ".join([str(s) for s in sum_row]))
        

### FIXED CODE ###

r, c =[int(i) for i in input().split()]
 
date =[]
sum_row = [0] * (c + 1)
 
for ri in range(r):
    date.append([int(i) for i in input().split()])
    date[ri].append(sum(date[ri]))
    print(" ".join([str(d) for d in date[ri]]))
    for ci in range(c + 1):
        sum_row[ci] += date[ri][ci]
 
print(" ".join([str(s) for s in sum_row]))
N = int(input())
A = list(map(int, input().split()))
if N == 1:
    print("Yes")
else:
    k = 0
    for i in range (N-1):
        if A[-(1 + i)] < A[-(2 + i)]:
            if (A[-(2 + i)] - A[-(1 + i)]) == 1:
                A[-(2 + i)] -= 1
            else:
                k = 114514
if k == 114514:
    print("No")
else:
    print("Yes")        

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N-1):
  if ans > A[i+1]:
    print('No')
    exit()
  if A[i+1]-A[i] >= -1:
    ans = max(A[i+1]-1,A[i]-1,ans)
    if A[i+1] >= A[i] and A[i+1] > ans :
      A[i+1] -=1
  else:
    print('No')
    exit()
print('Yes')
W,H,x,y=map(int,input().split())
if x=W/2 and y=H/2:
    print(W*H/2,1)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
"""else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)"""


### FIXED CODE ###

W,H,x,y=map(int,input().split())
if x==W/2 and y==H/2:
    print(W*H/2,1)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(W*H/2,0)
N = int(input())
A = list(map(int, input().split()))
import numpy as np
A = np.array(A)
count = 0
while((A%2==0).all()):
    A=A/2
    count+=1
print(count)

### FIXED CODE ###

import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
count = 0
while((A%2==0).all()):
    A=A/2
    count+=1
print(count)
n, k = map(int, input().split())
s = input()
count = 0
s = 'X' + s + 'X'
for i in range(1, n+1):
    print(f's[i]: {s[i]} s[i-1]: {s[i-1]} s[i+1]:{s[i+1]}')
    if (s[i] == s[i-1] and s[i] == 'L') or \
        (s[i] == s[i+1] and s[i] == 'R'):
        count += 1
if count == n-2:
    print(count + 1)
else:
    print(count + 2*k)

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
count = 0
s = 'X' + s + 'X'
for i in range(1, n+1):
    #print(f's[i]: {s[i]} s[i-1]: {s[i-1]} s[i+1]:{s[i+1]}')
    if (s[i] == s[i-1] and s[i] == 'L') or \
        (s[i] == s[i+1] and s[i] == 'R'):
        count += 1
print(min(n-1, count + 2*k))
import math

N = int(input())

if N == 2:
    cnt = 1
elif N == 3:
    cnt = 3
    
elif N > 3:
    for i in range(1,N-1):
        A = N-i
        rA = math.sqrt(A)
        intA = math.floor(rA)
        if rA == intA:
            cnt -= 1
        if intA == 1:
            cnt += 1
        else:
            for j in range(1,intA+1):
                if A%j == 0:
                    cnt += 2

print(cnt)

### FIXED CODE ###

S = input()
l = len(S)
if S[l-1]=='s':
    S = S + 'es'
else:
    S = S + 's'
print(S)
a = []
while(1):
    n = input()
    if (n == 0):
        break
    a.append(n)

for i in range(len(a)):
        print('Case '+str(i)+': '+str(a[i]))

### FIXED CODE ###

i=1
while(1):
    n=input()
    if(int(n)==0):
        break
    else:
        print('Case '+str(i)+': '+n)
        i+=1
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())
A = 0
B = 0
ans = 0
pre_ans = 0
for i in range(N):
    if x[i]>=0 and y[i]>=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]<0 and x[i]+y[i]>0:
        A+=x[i]
        B+=y[i]
ans = (A**2+B**2)**0.5

A = 0
B = 0
for i in range(N):
    if x[i]>=0 and y[i]<=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]>0 and x[i]-y[i]>0:
        A+=x[i]
        B+=y[i]
pre_ans = (A**2+B**2)**0.5
if pre_ans > ans:
    ans = pre_ans

A = 0
B = 0
for i in range(N):
    if x[i]<=0 and y[i]<=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]<0 and x[i]+y[i]<0:
        A+=x[i]
        B+=y[i]
pre_ans = (A**2+B**2)**0.5
if pre_ans > ans:
    ans = pre_ans

A = 0
B = 0
for i in range(N):
    if x[i]<=0 and y[i]>=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]>0 and -x[i]+y[i]>0:
        A+=x[i]
        B+=y[i]
pre_ans = (A**2+B**2)**0.5
if pre_ans > ans:
    ans = pre_ans





print(ans)


### FIXED CODE ###

S = input()
T = input()

ans = 0
if S[0:1] == T[0:1]:
    ans +=1

if S[1:2] == T[1:2]:
    ans +=1

if S[2:3] == T[2:3]:
    ans +=1

print(ans)
N, M = [int(i) for i in input().split()]
WA, AC = [0] * M, [False] * M
wa, ac = 0, 0
for i in range(M):
    inp = input().split()
    P, S = int(inp[0]), inp[1]
    if S == "AC":
        AC[P] = True
        ac += 1
        wa += WA[P]
    elif S == "WA":
        WA[P] += 1
print(ac, wa)


### FIXED CODE ###

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

ac, wa = 0, 0
hist_ac, hist_wa = [0] * N, [0] * N
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if hist_ac[p] == 0:
        if s == "AC":
            hist_ac[p] = 1
            ac += 1
            wa += hist_wa[p]
        else:
            hist_wa[p] += 1
print(ac, wa)
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  5 19:16:59 2018
ABC104C
@author: maezawa
"""
import math

d, g = list(map(int, input().split()))
p = []
c = []
for i in range(d):
    pi, ci = list(map(int, input().split()))
    p.append(pi)
    c.append(ci)
 
min_cnt = 10**11 
    
for i in range(2**d):
    istr = '0'*d + format(i,'b')
    used = []
    cnt = 0
    maney = 0   
    for j in range(d):
        if istr[-1-j] == '1':
            maney += c[j]+p[j]*(j+1)*100
            cnt += p[j]
            used.append(j)
    if maney > g:
        if min_cnt > cnt:
            min_cnt = cnt
            #print(istr)
            continue
    else:
        k = d-1
        while k<d:
            if k not in used:
                break 
            k -= 1
        rem = math.ceil((g-maney)/(100*(k+1)))
        if rem >= p[k]:
            continue
        else:
            cntp = cnt + rem
            if min_cnt > cntp:
                min_cnt = cntp
                #print(istr, rem)
                continue
    #print(min_cnt, istr)
print(min_cnt)
                        
        
            

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Aug  5 19:16:59 2018
ABC104C
@author: maezawa
"""
import math

d, g = list(map(int, input().split()))
p = []
c = []
for i in range(d):
    pi, ci = list(map(int, input().split()))
    p.append(pi)
    c.append(ci)
 
min_cnt = 10**11 
    
for i in range(2**d):
    istr = '0'*d + format(i,'b')
    used = []
    cnt = 0
    maney = 0   
    for j in range(d):
        if istr[-1-j] == '1':
            maney += c[j]+p[j]*(j+1)*100
            cnt += p[j]
            used.append(j)
    if maney >= g:
        if min_cnt > cnt:
            min_cnt = cnt
            #print(istr)
            continue
    else:
        k = d-1
        while k>=0:
            if k not in used:
                break 
            k -= 1
        rem = math.ceil((g-maney)/(100*(k+1)))
        if rem >= p[k]:
            continue
        else:
            cntp = cnt + rem
            if min_cnt > cntp:
                min_cnt = cntp
                #print(istr, rem)
                continue
    #print(min_cnt, istr)
print(min_cnt)
N = int(input)
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count = count + 1
print (count)

### FIXED CODE ###

N = int(input())
S = input()
print(S.count("ABC"))
n,a=map(int,input().split())
*x,=map(int,input().split())
b=max(x)
dp=[[[0]*(n*b+1) for i in range(n+1)] for _ in range(n+1)]

for i in range(n+1):
    for j in range(n+1):
        for k in range(n*b+1):
            if i==0 and j==0 and k==0:
                dp[i][j][k]=1
            elif i and k<x[i-1]:
                dp[i][j][k]=dp[i-1][j][k]
            elif i and j and k>=x[i-1]:
                dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-x[i-1]]

v=0
for i in range(1,n+1):
    v+=dp[n][i][i*a]
print(v)

### FIXED CODE ###

n,a=map(int,input().split())
l=list(map(int,input().split()))
x=max(l)
x=max(x,a)
dp=[[[0 for _ in range(n*x+1)] for _ in range(n+1)] for _ in range(n+1)]

for j in range(n+1):
  for k in range(n+1):
    for s in range(n*x+1):
      if j==0 and k==0 and s==0:
        dp[j][k][s]=1
      elif j>=1 and s<l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-l[j-1]]
      else:
        dp[j][k][s]=0

s=0
for k in range(1,n+1):
  s+=dp[n][k][k*a]

print(s)
n,q = map(int, input().split())
s = input()

t = [0] * n +1
for i in range(n):
    t[i+1] = t[i] + (1if s[i:i+2] == "AC" else 0)
    
for i in range(q):
    l,r = map(int, input().split())
    print(t[r-1] - t[l-1])

### FIXED CODE ###

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

t = [0] * (n +1)
for i in range(n):
    t[i+1] = t[i] + (1if s[i:i+2] == "AC" else 0)
    
for i in range(q):
    l,r = map(int, input().split())
    print(t[r-1] - t[l-1])
A, B = map(int, input().split())

print(6 - A - B)

### FIXED CODE ###

A = int(input())
B = int(input())

print(6 - A - B)
import sys
r = int(sys.stdin.readline())
if r < 1200: print("ABC")
elif r < 2800: print("ARC")
else print("AGC")

### FIXED CODE ###

import sys
r = int(sys.stdin.readline())
if r < 1200: print("ABC")
elif r < 2800: print("ARC")
else: print("AGC")
dat=input()
print(dat.count('1')

### FIXED CODE ###

dat = input()
print(dat.count('1'),end="")
def resolve():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    C = list(map(int, input().split()))

    ans = -100100100
    for i in range(N):
        node_set = set()
        n = P[i]
        score = 0
        t = []
        while n not in node_set:
            score += C[n-1]
            t.append(score)
            node_set.add(n)
            n = P[n-1]

        if K < len(t):
            max_t = max(t[:K])
        else:
            if t[-1] > 0:
                temp = t[-1] * int(K / len(t)) + max([0] + t[:K%len(t)])
                max_t = max(max_t, temp)
            else:
                max_t = max(t)
        ans = max(ans, max_t)

    print(ans)


if __name__ == "__main__":
    resolve()

### FIXED CODE ###

def resolve():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    C = list(map(int, input().split()))
    for i in range(N):
        P[i] -= 1

    ans = -1e18
    for i in range(N):
        n = P[i]
        score = C[n]
        t = [score]
        while n != i:
            n = P[n]
            score += C[n]
            t.append(score)

        total = t[-1]
        l = len(t)
        for i in range(min(K, l)):
            temp_score = t[i]
            if total > 0 and K > l:
                e = int((K-(i+1))/l)
                temp_score += total*e
            ans = max(ans, temp_score)

    print(ans)


if __name__ == "__main__":
    resolve()
N = int(input())
A = list(map(int,input().split())
a = 0
b = 0
while len(A)>= 1:
    a = a + max(A)
    A.remove(max(A))
    b = b + max(A)
    A.remove(max(A))
print(a-b)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
a = 0
b = 0
A.sort(reverse=True)
for i in range(N):
    if i%2 == 0:
        a = a + A[i]
    if i%2 == 1:
        b = b + A[i]
print(a-b)
A, B, C = map(int, input().split())
if A > C:
    print('No')
elif:
   B < C:
    print('No')
else:
   print('Yes')

### FIXED CODE ###

A, B, C = map(int, input().split())
if A < C < B:
    print('Yes')
elif B < C < A:
    print('Yes')
else:
   print('No')
#coding:utf-8

if __name__ == "__main__":

    i = str(input())

    j = i.split('/')

    print(j[1].split('0')[1])

    if int(j[0]) < 2019:
        print("Heisei")
    elif int(j[1].split('0')[1]) < 5:
        print("Heisei")
    else:
        print("TBD")

### FIXED CODE ###

#coding:utf-8

if __name__ == "__main__":

    i = str(input())

    j = i.split('/')

    if int(j[0]) < 2019:
        print("Heisei")
    elif int(j[1]) < 5:
        print("Heisei")
    else:
        print("TBD")
yukichi_num = 0
ichiyou_num = 0
a,b = map(int,input().split())
for i in range(a+1):
    for  n in range(a+1-i):
        if i*10000+n*5000+1000*(a-i-n) == b:
            print('{0} {1} {2}'.format(i,n,a-i-n))
            exit()
print('-1 -1 -1')

### FIXED CODE ###

a = input()
print("2018"+a[4::])
import math

n, m = map(int, input().split())
s = input()
t = input()

s_num = [0] * n
t_num = [0] * m
s_num[0], t_num[0] = 1, 1
l = n * m / math.gcd(n, m)

for i in range(1, n):
    s_num[i] = i * l / n + 1

for i in range(1, m):
    t_num[i] = i * l / m + 1

match_num = list(set(s_num) & set(t_num))
ans = l

for i in range(len(match_num)):
    s_str = s[s_num.index(match_num[i])]
    t_str = t[t_num.index(match_num[i])]

    if s_str != t_str:
        ans = -1
        break

print(ans)


### FIXED CODE ###

import fractions


def binary_search(list, number, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) // 2
        guess = list[mid][0]
        if guess == number:
            if list[mid][1] == item:
                return False
            else:
                return True
        if guess > number:
            high = mid - 1
        else:
            low = mid + 1
    # 見つからなかったとき
    return False


n, m = map(int, input().split())
s = input()
t = input()
check = []
l = n * m // fractions.gcd(n, m)
for i in range(n):
    check.append([i * l // n, s[i]])
for i in range(m):
    if binary_search(check, i * l // m, t[i]):
        print(-1)
        exit()
print(l)
N = int(input())
h_list = list(map(int, input().split(' ')))


def mizuyari(h_list, l, r):
    import pdb;pdb.set_trace()
    num_mizuyari = min(h_list[l:r+1])
    h_list = [h - num_mizuyari if l <= x and x <= r else h for x, h in enumerate(h_list)]
    zero_posi = h_list[l:].index(0) + l
    if l == zero_posi:
        first_non_zero_posi = [x for x, h in enumerate(h_list) if h != 0]
        if not first_non_zero_posi:
            print(sum_mizuyari + num_mizuyari)
            exit()
        l = first_non_zero_posi[0]
        if list(range(l, len(h_list))) == first_non_zero_posi:
            return h_list, num_mizuyari, l, len(h_list)
        zero_posi = h_list[l:].index(0) + l
    new_r = zero_posi - 1
    return h_list, num_mizuyari, l, new_r
l = 0
r = len(h_list) - 1
sum_mizuyari = 0
while True:
    h_list, num_mizuyari, l, r = mizuyari(h_list, l, r)
    sum_mizuyari += num_mizuyari

### FIXED CODE ###

N = int(input())
h_list = list(map(int, input().split(' ')))


def mizuyari(h_list, l, r):
    num_mizuyari = min(h_list[l:r+1])
    h_list = [h - num_mizuyari if l <= x and x <= r else h for x, h in enumerate(h_list)]
    zero_posi = h_list[l:].index(0) + l
    if l == zero_posi:
        first_non_zero_posi = [x for x, h in enumerate(h_list) if h != 0]
        if not first_non_zero_posi:
            print(sum_mizuyari + num_mizuyari)
            exit()
        l = first_non_zero_posi[0]
        if list(range(l, len(h_list))) == first_non_zero_posi:
            return h_list, num_mizuyari, l, len(h_list)
        zero_posi = h_list[l:].index(0) + l
    new_r = zero_posi - 1
    return h_list, num_mizuyari, l, new_r
l = 0
r = len(h_list) - 1
sum_mizuyari = 0
while True:
    h_list, num_mizuyari, l, r = mizuyari(h_list, l, r)
    sum_mizuyari += num_mizuyari
pi=3.141592653589793
r=int(input())
area=r**2*pi
circumference=r*2*pi
print("{0:.5f} {1:.5f}".format(area,circumference))


### FIXED CODE ###

import math
r=float(input())
area=r**2*math.pi
circumference=r*2*math.pi
print("{0:.5f} {1:.5f}".format(area,circumference))
fastio():
    import sys
    from io import StringIO 
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
from collections import defaultdict as dd
from math import gcd

a, b, c = I()
if a + b + c >= 22:
    print('bust')
else:
    print('win')


### FIXED CODE ###

def fastio():
    import sys
    from io import StringIO 
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
from collections import defaultdict as dd

a, b, c = I()
if a + b + c >= 22:
    print('bust')
else:
    print('win')
from queue import Queue

def main():
  n, m = map(int, input().split())

  edges = [[] for _ in range(m)]

  for _ in range(m):
    a, b = map(lambda x: int(x) - 1, input().split())

    edges[a].append(b)
    edges[b].append(a)

  visited = {}

  q = Queue()
  q.put((0, -1))

  while q.qsize() > 0:
    (current, prev) = q.get()
    if current in visited:
      continue

    visited[current] = prev

    for nxt in edges[current]:
      q.put((nxt, current))

  if len(visited) == n:
    print("Yes")
    for i in range(1, n):
      print(visited[i] + 1)
  else:
    print("No")


main()


### FIXED CODE ###

from queue import Queue
import sys

sys.setrecursionlimit(10 ** 6)

def main():
  n, m = map(int, input().split())

  edges = [[] for _ in range(n)]

  for _ in range(m):
    a, b = map(lambda x: int(x) - 1, input().split())
    edges[a].append(b)
    edges[b].append(a)

  visited = {0: -1}

  q = Queue()
  q.put(0)

  while not q.empty():
    current = q.get()
    for nxt in edges[current]:
      if nxt not in visited:
        visited[nxt] = current
        q.put(nxt)

  if len(visited) == n:
    print("Yes")
    for i in range(1, n):
      print(visited[i] + 1)
  else:
    print("No")


main()
money = int(input())
while money > 1000
    money -= 1000
print(1000 - money)

### FIXED CODE ###

money = int(input())
while money > 1000 :
    money -= 1000
print(1000 - money)
M,N = input().split()
A = list(input().split())mport numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))

all_sum_a = np.sum(A)

if M<=np.sum(A>=all_sum_a/(4*M)):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))

all_sum_a = np.sum(A)

if M<=np.sum(A>=all_sum_a/(4*M)):
    print('Yes')
else:
    print('No')
N, M = map(int, input().split())
ans = [0 for _ in range(N)]
if N == 1:
	ans[0] = 0
else:
	ans[0] = 1
f = 1
flg = [-1 for _ in range(M + 1)]

for _ in range(M):
	s, c = map(int, input().split())
	if s == 1 and c == 0 and N != 1: 
		f = 0
	if flg[s] != -1 and flg[s] != c:
		f = 0
	else:
		flg[s] = c
		ans[s - 1] = c

if f:
	for a in ans:
		print(a, end = "")
else:
	print(-1)

### FIXED CODE ###

N, M = map(int, input().split())
ans = [0 for _ in range(N)]
if N == 1:
	ans[0] = 0
else:
	ans[0] = 1
f = 1
flg = [-1 for _ in range(M + 1000)]

for _ in range(M):
	s, c = map(int, input().split())
	if s == 1 and c == 0 and N != 1: 
		f = 0
	if flg[s] != -1 and flg[s] != c:
		f = 0
	else:
		flg[s] = c
		ans[s - 1] = c

if f:
	for a in ans:
		print(a, end = "")
else:
	print(-1)
import math
import functools
import fractions

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

if max(v) % 2 ==0:
	b = True
else:
	b = False
		
v.sort()

for index,_ in enumerate(v):
	if _  % 2 ==0:
		if not b:
			v[index] = v[-1]
			break
			
	else:
		if b:
			v[index] = v[-1]
			break
				
#ans = functools.reduce(math.gcd,v)
#ans = v[0]
for i in range(1,len(v)):
	ans = fractions.gcd(ans, v[i])
	
print(ans)



### FIXED CODE ###

a,b,t = map(int, input().split())
c = 0
tt = 0

while t + 0.5 > tt + a:
	c+= b
	tt += a	

	
print(c)
n=int(input())
seq=list(map(int,input().split()))
p=1
f=1
for i in range(n):
	p*=seq[i]
    if(p>=10**18):
		print(-1)
        f=0
        break
if f==1:
  print(p)
       
	

### FIXED CODE ###

n=int(input())
seq=list(map(int,input().split()))
p=1
f=1
c=int(1e18)
if 0 in seq:
    print(0)
else:
    for i in range(n):
        p*=seq[i]
        if p>c:
            print(-1)
            f=0
            break
            
    if f==1:
        print(p)
import numpy as np
N, W = map(int, input().split())

inf = float("inf")

max_v = 1000 * N + 1
dp = [inf for _ in range(max_v)]
dp[0] = 0
sum_v = 0

for i in range(N):
    w, v = map(int, input().split())
    for j in range(max_v, v-1, -1):
        new = dp[j-v] + w
        if new > W:
            continue
        if dp[j] > new:
            dp[j] = new

ans = 0
for sum_v in range(max_v):
    if dp[sum_v] <= W:
        ans = sum_v
print(ans)

### FIXED CODE ###

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

inf = float("inf")

max_v = 1000 * N + 1
dp = [inf for _ in range(max_v)]
dp[0] = 0
sum_v = 0

for i in range(N):
    w, v = map(int, input().split())
    for j in range(max_v, v-1, -1):
        new = dp[j-v] + w
        if new > W:
            continue
        if dp[j] > new:
            dp[j] = new

ans = 0
for sum_v in range(max_v):
    if dp[sum_v] <= W:
        ans = sum_v
print(ans)
import collections
N = int(input())
S = list(input())
cnt = 0
cntW = 0
cntE = 0
n = N-1

index = 0
for i in range(N-1):
    if S[i] != S[i+1]:
        cnt += 1
        index = i
i = 0
if cnt == 1:
    m = min(index,n-index)
    print(m)
    exit()
else:
    while i != n-1:
        if S[n] == 'E':
            cntE += 1
        if S[i] == 'W':
            i += 1
            n -= 1
            cntW += 1
        else:
            i += 1
print(cntW+cntE)
    


### FIXED CODE ###

import collections
N = int(input())
S = list(input())
cnt = 0

ans = [0]*N

for i in range(1,N):
    if S[i] == "E":
        cnt += 1
ans[0] = cnt

for i in range(1,N):
    if S[i-1] == 'E' and S[i] == 'E':
        ans[i] = ans[i-1]-1
    elif S[i-1] == "W" and S[i] == 'W':
        ans[i] = ans[i-1]+1
    else:
        ans[i] = ans[i-1]
     
print(min(ans))
a = []
while True:
  n = int(input())
  if n == 0:
    break
     a.append(n)
for i in range(len(a)):
  print("Case {0}: {1}".format(i + 1, a[i]))


### FIXED CODE ###

a = []
while True:
  n = int(input())
  if n == 0:
    break
  a.append(n)
for i in range(len(a)):
  print("Case {0}: {1}".format(i + 1, a[i]))
s=str(input())
price=700

if s[0]=o:
  price+=100
if s[1]=o:
  price+=100
if s[2]=o:
  price+=100

print(price)

### FIXED CODE ###

S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)
a=list(map(int,input()))
if a[0]*a[1]>a[2]:
  print(a[2])
else:
  print(a[0]*a[1])


### FIXED CODE ###

a=list(map(int,input().split()))
print(min(a[0]*a[1],a[2]))