Harryxun/stf_run huggingface dataset:
import sys
s=input()
ans=0
i=0
j=len(s)-1
xi=0
yj=0
while(i<j):

    while(s[i]=='x'):
        i+=1
        xi+=1
#        print(i,xi)

    while(s[j]=='x'):
        j-=1
        yj+=1
#        print(j,yj)

    print(i,xi,j,yj)
    if(s[i]!=s[j]):
        print(-1)
        sys.exit()
    else:
        ans+=abs(xi-yj)
        xi=0
        yj=0
        i+=1
        j-=1

print(ans)

### FIXED CODE ###

import sys
s=input()
ans=0
i=0
j=len(s)-1
xi=0
yj=0
while(i<j):

    while(i<len(s)-1 and s[i]=='x'):
        i+=1
        xi+=1
#        print(i,xi)

    while(j>0 and s[j]=='x'):
        j-=1
        yj+=1
#        print(j,yj)

#    print(i,xi,j,yj)
    if(s[i]!=s[j]):
        print(-1)
        sys.exit()
    else:
        ans+=abs(xi-yj)
        xi=0
        yj=0
        i+=1
        j-=1

print(ans)
import numpy as np
x1, y1, x2, y2 = map(int, input().split())

R = np.array([[0,-1],[1,0]])

r1 = np.array([x2-x1, y2-y1])
r2 = R @ r1
x3, y3 = r2 + np.array([x2, y2])
r3 = R @ r2
x4, y4 = r3 + np.array([x3, y3])

print(x3, y3, x4, y4)

### FIXED CODE ###

import numpy as np
x1, y1, x2, y2 = map(int, input().split())

R = np.array([[0,-1],[1,0]])

r1 = np.array([x2-x1, y2-y1])
r2 = np.dot(R, r1)
x3, y3 = r2 + np.array([x2, y2])
r3 = np.dot(R, r2)
x4, y4 = r3 + np.array([x3, y3])

print(x3, y3, x4, y4)
import sys
import bisect
input = sys.stdin.readline

def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = sorted(list(map(int, input().split())))
    c = list(map(int, input().split()))

    sum_c = [0] * (max(max(c), b[-1]) + 2)
    for i in range(N):
        sum_c[c[i]] += 1
    
    for i in range(len(sum_c)-2, -1, -1):
        sum_c[i] += sum_c[i+1]
    
    count = [0] * N
    for i in range(N):
        count[i] = sum_c[b[i]+1]
    for i in range(N-2, -1, -1):
        count[i] += count[i+1]
    # print(count)
    ans = 0
    for i in range(N):
        a_ = a[i]
        b_i = bisect.bisect_left(b, a_+1)
        if b_i < N:
            # print("{}より大きくて最小のbは{}でcount[{}] := {}".format(a_, b[b_i], b_i, count[b_i]))
            ans += count[b_i]
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import bisect
input = sys.stdin.readline

def main():
    N = int(input())
    a = sorted(list(map(int, input().split())))
    b = sorted(list(map(int, input().split())))
    c = sorted(list(map(int, input().split())))

    ans = 0
    for i in range(N):
        tmp = bisect.bisect_right(a, b[i]-1)
        tmp *= N - bisect.bisect_left(c, b[i]+1)
        ans += tmp
    print(ans)

if __name__ == "__main__":
    main()
x1, y1, x2, y2 = map(int, input().split())
diff_x, diff_y = x2 - x1, y2 - y1
print(x2 - diff_y, y2 + diff_x, x1 - diff_y, y1 + diff_x)


### FIXED CODE ###

k = int(input())
if k % 2 == 0:
    print( (k // 2) * (k // 2 ))
else:
    print( ((k - 1) // 2 + 1) * ((k - 1) // 2) )
list = [input() for _ in range 2]
if list[1] == list[2][:-1]:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

list = [input() for i in range (2)]
if list[0] == list[1][:-1]:
  print("Yes")
else:
    print("No")
import itertools
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
tmp = list(itertools.permutations(list(range(N)),N))
length = []
for i in range(len(tmp)):
    tmplen = ((xy[tmp[i][0]][0]-xy[tmp[i][1]][0])**2+(xy[tmp[i][0]][1]-xy[tmp[i][1]][1])**2)**(1/2)
    tmplen += ((xy[tmp[i][1]][0]-xy[tmp[i][2]][0])**2+(xy[tmp[i][1]][1]-xy[tmp[i][2]][1])**2)**(1/2)
    length.append(tmplen)
print(sum(length)/len(length))
print(xy)

### FIXED CODE ###

import itertools
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
tmp = list(itertools.permutations(list(range(N)),N))
length = []
for i in range(len(tmp)):
    tmplen = 0
    for j in range(N-1):
        tmplen += ((xy[tmp[i][j]][0]-xy[tmp[i][j+1]][0])**2+(xy[tmp[i][j]][1]-xy[tmp[i][j+1]][1])**2)**(1/2)
    length.append(tmplen)
print(sum(length)/len(length))
import numpy as np

def main():
    a=inputList()
    if(a[0]>a[1]):
        print("GREATER")
    elif(a[0]<a[1]):
        print("LESS")
    else:
        print("EQUAL")

def inputList():
    a=list(map(int,input().split()))
    return a

def multisort(li,index):
    return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
    main()


### FIXED CODE ###

import numpy as np

def main():
    a=int(input())
    b=int(input())
    if(a>b):
        print("GREATER")
    elif(a<b):
        print("LESS")
    else:
        print("EQUAL")

def inputList():
    a=list(map(int,input().split()))
    return a

def multisort(li,index):
    return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
    main()
print("Chistmas"+" Eve"+(25-input()))

### FIXED CODE ###

print("Christmas"+" Eve"*(25-int(input())))
S=input()
T=input()

T_=slice(T[:-1])

if (S==T_):
    print("Yes")
elif:
    print("No")

### FIXED CODE ###

S=input()
T=input()

T_=T[:-1]
if (S==T_):
    print("Yes")
else:
    print("No")
yohou = input().rstrip().split("")
tenki = input().rstrip().split("")
 
tekichu = 0
 
for i in range(3):
	if yohou[i] == tenki[i]:
	tekichu += 1
 
print(tekichu)

### FIXED CODE ###

s = list(input())
t = list(input())

cnt = 0
for i in range(3):
  if s[i] == t[i]:
    cnt += 1

print(cnt)
H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]
output = []
for i in range(H-1):
    for j in range(W):
        if a[i][j] % 2 == 1:
            a[i+1][j] += 1
            output.append([i+1, j+1, i+2, j+1])

for i in range(W):
    if a[-1][i] % 2 == 1:
        a[-1][i+1] += 1
        output.append([H, i+1, H, i+2])
print(len(output))
for o in output:
    for xy in o:
        print(xy, end=' ')
    print()

### FIXED CODE ###

H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]
output = []
for i in range(H-1):
    for j in range(W):
        if a[i][j] % 2 == 1:
            a[i+1][j] += 1
            output.append((i+1, j+1, i+2, j+1))

for i in range(W-1):
    if a[-1][i] % 2 == 1:
        a[-1][i+1] += 1
        output.append((H, i+1, H, i+2))
print(len(output))
for y, x, ay, ax in output:
    print(y, x, ay, ax)
n_list=input().split()
n_list_int=[int(n) for n in n_list]
n_list_int.sort()
ans=n_list_sort[2]*10+n_list_sort[1]+n_list_sort[0]
print[ans]

### FIXED CODE ###

abclist=input().split()
abclist_int=[int(i) for i in abclist]
abclist_int.sort()
ans=abclist_int[2]*10+abclist_int[1]+abclist_int[0]
print(ans)
temp = str(input())
count = 0

for i in temp:
  if i == R:
    count = count + 1
  else:
    count = 0
    
print(count)

### FIXED CODE ###

temp = str(input())
count = 0
max_count = 0 

for i in temp:
  if i == 'R':
    count = count + 1
    max_count = count
  else:
    if max_count < count:
      max_count = count
    count = 0
    
print(max_count)
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import floyd_warshall
N,M,L=map(int,input().split())
ABC=[map(int,input().split()) for _ in range(M)]
Q=int(input())
ST=[list(map(int,input().split())) for _ in range(Q)]

E=[[10**10]*N for _ in range(N)]
for a,b,c in ABC:
    E[a-1][b-1]=c
    E[b-1][a-1]=c
G = csgraph_from_dense(E, null_value=10**10)
d = floyd_warshall(G)
E=[[1 if __<= L else 10**10 for __ in _] for _ in d]
G = csgraph_from_dense(E, null_value=10**10)
E = floyd_warshall(G)

for s,t in ST:
    if E[s-1][t-1]==float('inf'):
        print(-1)
    else:
        print(int(E[s-1][t-1]-1))

### FIXED CODE ###

from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
import numpy as np
N,M,L=map(int,input().split())
A=[0]*M
B=[0]*M
C=[0]*M
for i in range(M):
    A[i],B[i],C[i] = map(int,input().split())
    A[i] -=1
    B[i] -=1
Q=int(input())
ST=[list(map(int,input().split())) for _ in range(Q)]


G = csr_matrix((C, (A, B)), shape=(N, N))
d = floyd_warshall(G, directed=False)
G=np.full((N,N), np.inf)
G[d<=L]=1
G = csr_matrix(G)
E = floyd_warshall(G, directed=False)

for s,t in ST:
    if E[s-1][t-1]==float('inf'):
        print(-1)
    else:
        print(int(E[s-1][t-1]-1))
N, X = map(int,input().split())
L = list(map(int, input().split()))

i = 0
D = 0

while D <= X:
    D = D + L[i]
    i = i + 1
    if i == N+1:
        break

print(i)

### FIXED CODE ###

N, X = map(int,input().split())
L = list(map(int, input().split()))

i = 1
D = 0

for l in L:
    D = D + l
    if X < D:
        break
    i = i +1
print(i)
n = int(input())
P = list(map(int,input().split()))
ans=0

for i in range(1,n-1):
  Q = (P[:i+1])
  if max(Q)!=P[i]:
        ans+=1
  if max(Q)==P[i]:
        ans+=0

print(ans+1)




### FIXED CODE ###

n,m = list(map(int,input().split()))
if n ==m:
    print("Yes")
if n!=m:
    print("No")
N,A,B=map(int,input().split())
i=N//((A+B)*(10**100))*A
if N%((A+B)*(10**100))>A:
    i=i+A
else:
    i=i+(N%(A+B)*(10**100))
print(i)


### FIXED CODE ###

S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')
A  = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


K  = input()
k = int(K)

print(A[k+1])


### FIXED CODE ###

A  = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


K  = input()
k = int(K)

print(A[k-1])
x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12]))&s0
s2=sum(map(lambda x:1<<(x-1),[4,6,9,11]))&s0
s3==sum(map(lambda x:1<<(x-1),[2]))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(list(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12])))&s0
s2=sum(list(map(lambda x:1<<(x-1),[4,6,9,11])))&s0
s3=sum(list(map(lambda x:1<<(x-1),[2])))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')
s = input()
num = len(s)
l, r = 0, num-1
ans = 0

while l != r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    else:
        ans += 1
        if s[l] == 'x':
            l += 1
        elif s[r] == 'x':
            r -= 1
        else:
            print(-1)
            break
print(ans)
    


### FIXED CODE ###

import sys
s = input()
num = len(s)
l, r = 0, num-1
ans = 0

while l < r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    else:
        ans += 1
        if s[l] == 'x':
            l += 1
        elif s[r] == 'x':
            r -= 1
        else:
            print(-1)
            sys.exit()
print(ans)
max_v = 1000000000
min_v = -1000000000

N = input()
data = []
for i in range(N):
    data.append(input())

for r in data:
    max_v = max(max_v, r - min_v)                                               
    min_v = min(min_v, r)
    
print(N)

### FIXED CODE ###

n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)
N, Y = map(int, input().split())
for x in range(0,N+1)
	for y in range(0,N+1-x)
		for z in range(0,N+1-x-y)			
   			if Y==10000*x+5000*y+1000*z:
    			print(x,y,z)
    			exit()
print(-1,-1,-1)

### FIXED CODE ###

N, Y = map(int, input().split())
 
for x in range(N+1):
  for y in range(N-x+1):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      print(x,y,z)
      exit()
print(-1,-1,-1)
num = input()
list = inpit().split()

def hoge(list):
  new_list = []
  for i in list:
    if i % 2 == 0:
      new_list.append(i)
    else:
      return False

count = 0
while(True);
  list = hoge(list)
  break if list == False
  count += 1

print(count)

### FIXED CODE ###

num = input()
listt = input().split()

def hoge(fuga):
    new_list = []
    for i in fuga:
        if int(i) % 2 == 0:
            new_list.append(int(i)/2)
        else:
            return False
    return new_list


count = 0
while True:
    listt = hoge(listt)
    if listt == False:
        break
    count += 1

print(count)
print("ABC" if int input() < 1200 else "ARC")

### FIXED CODE ###

n = int(input())
print("ABC" if 0 <= n < 1200 else "ARC")
def main():
    import collections
    import sys
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=tuple(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import collections
    import sys
    sys.setrecursionlimit(5000000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        if len(c)<3:
            print(0)

        else:

            list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
            list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
            list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
            list23=[]

        
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()
from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積, 深いネストにも使える）
    combinations_with_replacement,  # 重複あり組み合わせ
)

N = int(input())

ans = [0] * (10**9)

for i, j, k in product(list(range(1, 101)), repeat=3):
    tmp = i**2 + j**2 + k**2 + i*j + j*k + k*i
    ans[tmp] += 1

for i in range(1, N+1):
    print(ans[i])


### FIXED CODE ###

from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積, 深いネストにも使える）
    combinations_with_replacement,  # 重複あり組み合わせ
)

N = int(input())

ans = [0] * (10**5)

for i, j, k in product(list(range(1, 101)), repeat=3):
    tmp = i**2 + j**2 + k**2 + i*j + j*k + k*i
    ans[tmp] += 1

for i in range(1, N+1):
    print(ans[i])
import numpy as np
import sys
input = sys.stdin.readline


N = int(input())

a = list(map(int, input().split()))
A = np.array([a for i in range(N)])
B = np.array([[a[i]] * N for i in range(N)])
C = A + B
d = [i for i in range(N)]
D = np.array([d for i in range(N)])
E = np.array([[i] * N for i in range(N)])

#print(D)
#print(E)
ind = D - E
#print(ind)
ans = C - ind
#print(ans)
#cnt = np.count_nonzero(ans == 0)
print(cnt)

### FIXED CODE ###

import collections

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

for i in range(N):
    B[i-A[i]] += 1 
    C[i+A[i]] += 1
#print(B)
#print(C)
ans = 0
for i in B:
    #print(i) i=Key
    if i in C:
        ans += B[i]*C[i]
print(ans)
s= input()
if s.endwith('s'):
  print(s+'es')
else:
  print(s+'s')

### FIXED CODE ###

s= input()
if s.endswith('s'):
  print(s+'es')
else:
  print(s+'s')
a,b=map(int(input().split()))
s=0
g=0
if a==1:
  s=300000
elif a==2:
  s=200000
elif a==3:
  s=100000
else:
  pass
if b==1:
  g=300000
elif b==2:
  g=200000
elif b==3:
  g=100000
else:
  pass
if a=1 and b=2:
  print(g+s+400000)
else:
  print(s+g)

### FIXED CODE ###

a,b=map(int,input().split())
s=0
g=0
if a==1:
  s=300000
elif a==2:
  s=200000
elif a==3:
  s=100000
else:
  s=0
if b==1:
  g=300000
elif b==2:
  g=200000
elif b==3:
  g=100000
else:
  g=0
if a==1 and b==1:
  print(g+s+400000)
else:
  print(s+g)
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input() for _ in range(H))]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[: -w - 1]#print(L)
print(np.max(U + D + L + R) - 3)

### FIXED CODE ###

import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[:, -w - 1]
print(np.max(U + D + L + R) - 3)
p=input;a=int(p())-int(p());print(['EQUAL','LESS'][a<0],'GREATER'][a>0])

### FIXED CODE ###

a,b=[int(input())for _ in[0]*2]
print("GREATER"if a>b else"ELQEUSASL"[a<b::2])
num = int(input())

s = input()
t = input()
u =[]

for _ in range(num):
  u.append(s[_] + t[_])

print(''.join(u))

### FIXED CODE ###

num = int(input())

s, t = input().split()
u =[]

for _ in range(num):
  u.append(s[_] + t[_])

ans = ''.join(u)

print(ans)
sum = 0
N = input() 
for i in range(int(N)):
	s = float(input())
	sum = sum+(1/s)
print(sum)

### FIXED CODE ###

sum = 0.00
s = 0 
N = int(input()) 
numlist = list(input().split())
for i in range(N):
	s = int(numlist[i])
	sum = sum+(1/s)
print(1/sum)
S = input()

if S[3] == S[4] and S[5] == S[6]: print('Yes')
else: print('No')

### FIXED CODE ###

S = input()
 
if S[2] == S[3] and S[4] == S[5]: print('Yes')
else: print('No')
import math
a,b,c=map(float,raw_input().split())
c = c / 180 * math.pi

print "%.10f" % float(a*b*math.sin(c)/2)
print "%.10f" % float(a + b + math.sqrt(a**2 + b**2)*cos(c))
print "%.10f" % float(b*math.sin(c))

### FIXED CODE ###

import math
a,b,c=map(float,raw_input().split())
c = c / 180 * math.pi

print "%.10f" % float(a*b*math.sin(c)/2)
x = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(c))
print "%.10f" % float(a + b + x)
print "%.10f" % float(b*math.sin(c))
h, w = map(int, input().split())
a=[list(map(int, input().split())) for i in range(h)]
l=[]
for i in range(h):
    for j in range(w):
        if a[i][j]%2==1:
            l.append((i,j))
def move(y1,x1, y2,x2):
    if y1<y2:
        for i in range(y1,y2):
            print(i+1, x1+1, i+2, x1+1)
    elif y1>y2:
        for i in range(y1,y2, -1):
            print(i+1, x1+1, i, x1+1)
    if x1<x2:
        for i in range(x1,x2):
            print(y2+1, i+1, y2+1, i+2)
    elif x1>x2:
        for i in range(x1,x2, -1):
            print(y2+1, i+1, y2+1, i)
ans=0
for i in range(0,len(l),2):
    ans+=abs(l[i][0]-l[i+1][0])+abs(l[i][1]-l[i+1][1])
print(ans)
for i in range(0,len(l),2):
    move(l[i][0],l[i][1],l[i+1][0],l[i+1][1])

### FIXED CODE ###

H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]
ans = []
for i in range(H-1):
    for j in range(W):
        if a[i][j] % 2 == 1:
            ans.append((i+1, j+1, i+2, j+1))
            a[i+1][j]+=1
for i in range(W-1):
    if a[H-1][i] % 2 == 1:
        ans.append((H, i+1, H, i+2))
        a[H-1][i+1] +=1
print(len(ans))
for a in ans:
    print(*a)
import sys
w,h,x,y=map(int,input().split())
#l=[int(i) for i in input().split()]
a=[y*w,(h-y)*w]
a.sort()
b=[x*h,(w-x)*h]
b.sort()
d=[a[0],b[0]]
d.sort()
#print(a,b,d)
#0,0 x,y 
if abs(h/w-y/x)< sys.float_info.epsilon:
    print((w*h)/2,0)
elif abs(h/w-y/(x-w))< sys.float_info.epsilon:
    print((w*h)/2,0)
elif (x==0 and y==0) or (x==w and y==h) or (x==0 and y==h) or (x==w and y==0):
    print((w*h)/2,0)
elif d[0]==d[1]:
    print(d[1],1)
else:
    print(d[1],0)


### FIXED CODE ###

w,h,x,y=map(int,input().split())
s=(w*h)/2
if (h//2==y and h%2==0) and (w//2==x and w%x==0):
    print(s,1)
else:
    print(s,0)
w, h, x, y, r=map(int,input().split())
if x-r=>0 && r+x=<w && y-r>0 && r+y<h:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

w, h, x, y, r=map(int,input().split())
if x-r>=0 and r+x<=w and y-r>=0 and r+y<=h:
    print("Yes")
else:
    print("No")
print(sum(sorted(map(int,input().split()))[::-1][1:2*int(input()):2]))

### FIXED CODE ###

N = int(input())
print(sum(sorted(map(int, input().split()))[::-1][1:2*N:2]))
R, G, B, N = map(int, input().split())

ans = 0
count = N // min(R, G, B) + 1
for r in range(count):
    if r * R > N:
        break
    for g in range(count):
        if r * R + g * G > N:
            break
        for b in range(count):
            if r * R + g * G + b * B == N:
                ans += 1
                break

print(ans)


### FIXED CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for r in range(N // R + 1):
    for g in range((N - R * r) // G + 1):
        tmp = N - r * R - g * G
        if tmp % B == 0:
            ans += 1

print(ans)
A = int(input())
B = int(input())
C = int(input())

if A == 5 or A == 7:
  if B == 5 or B == 7:
    if C == 5 or C == 7:
      if A + B + C == 17:
        print('Yes')
      else:
        print('No')
    else:
      print('No')
  else:
  	print('No')
else:
  print('No')
  

### FIXED CODE ###

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

if A == 5 or A == 7:
  if B == 5 or B == 7:
    if C == 5 or C == 7:
      if A + B + C == 17:
        print('YES')
      else:
        print('NO')
    else:
      print('NO')
  else:
  	print('NO')
else:
  print('NO')
from collections import deque
import queue
n,m = map(int,input().split())

uv = [[] for i in range(n)]

for i in range(m):
    u,v = map(int,input().split())
    #uv[v-1].append(u-1)
    uv[u-1].append(v-1)
    
s,t = map(int,input().split())

check = [[0 for i in range(3)] for j in range(n)]

d = queue.Queue()
d.put([0,0,s-1])
#check[s-1][0] = 1

while len(d) > 0:
    for i in range(len(d)):
        num,cnt,ver = d.get()
        check[ver][num] = 1
        num = (num+1)%3
        cnt += 1
        for j in range(len(uv[ver])):
            #print(cnt,num,ver,j,t-1,uv[ver][j])
            if uv[ver][j] == t-1 and num == 0:
                print(cnt//3)
                exit()
            if check[uv[ver][j]][num] == 0:
                #check[uv[ver][j]][num] = 1
                d.put([num,cnt,uv[ver][j]])
                
print(-1)

### FIXED CODE ###

# coding: utf-8
import sys
from heapq import heapify, heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# vertexごとに3つの状態数を持つ
N, M = lr()
graph = [[] for _ in range((N+1)*3)]  # 1-indexed
for _ in range(M):
    a, b = lr()
    a *= 3; b *= 3
    for i in range(3):
        j = i+1 if i < 2 else 0
        graph[a+i].append(b+j)

INF = 10 ** 15

def dijkstra(start):
    dist = [INF] * (N+1) * 3
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, prev = heappop(que)
        if dist[prev] < d:
            continue
        for i in graph[prev]:
            #print(graph[prev],dist[next],next)
            d1 = d + 1
            if dist[i] > d1:
                dist[i] = d1
                heappush(que, (d1, i))
    return dist

S, T = lr()
dist = dijkstra(S*3)
answer = dist[T*3]
if answer == INF:
    answer = -1
else:
    answer //= 3
print(answer)
def gcd(a,b):
    
    if a == 1 or b == 1:
        return 1
    if a == b:
        return a
    if a > b:
        a,b = b,a
    if b%a == 0:
        return a
    b = b%a
    return gcd(a,b)

N = int(input())
A = 1

for _ in range(N):
    B = int(input())
    ans = int(A*B/gcd(A,B))
    A = ans
print(ans)

### FIXED CODE ###

def gcd(a,b):
    if a%b == 0:
        return b
    return gcd(b,a%b)

N = int(input())
ans = 1
for _ in range(N):
    A = int(input())
    ans = ans*A//gcd(ans,A)
print(ans)