Harryxun/stf_run huggingface dataset:
# encoding: utf-8
import math
N, M = map(int, input().split())

def distribute(pos, full, tmp):
    return memo[tmp][pos]

# define search range
p_max = int(M / 2) # M is prime if M has a factor p (> p_max)
ip_up = int(math.log2(p_max))

#### O(MlogM) below (if M has a very large prime factor)
M_tmp = M
ips = []
psuedo_primes = [max((2, 2 * i + 1)) for i in range(p_max // 2)]
for p in psuedo_primes:
    # how many times M_tmp can be divided
    p_tmp = p
    for i_p in range(ip_up + 1):
        if M_tmp % p_tmp > 0: break
        p_tmp = p_tmp * p
    # escape if M_tmp cannot be divided
    if i_p < 1: continue
    # calculate later
    ips.append(i_p)
    # next
    M_tmp = M_tmp // (p_tmp // p)
    if M_tmp == 1: break
#### O(Mlog M) above

#### O(N) below
# create memo
## init
if len(ips) > 0: ip_max = max(ips)
else: ip_max = 0
memo = [[None] * N for i in range(ip_max + 1)] # max ip
for j in range(N): memo[0][j] = 1
for i in range(1, ip_max + 1): memo[i][N - 1] = 1
## fill
for i in range(1, ip_max + 1):
    sum_tmp = 0
    vals = list(memo[i - 1])[::-1]
    p_memo = memo[i]
    for j, val in enumerate(vals):
        sum_tmp += val
        p_memo[N - 1 - j] = sum_tmp
#### O(N) above
        
# calculate ans
ans = 1
for i_p in ips: ans = (ans * distribute(0, i_p, i_p)) % (10 ** 9 + 7) # oh...
    
print(ans)

### FIXED CODE ###

# encoding: utf-8
import math
N, M = map(int, input().split())

ips = []
M_tmp = M
for p in range(2, int(math.sqrt(M)) + 1):
    if M_tmp % p > 0: continue
    for i_p in range(1, 33):
        if M_tmp % (p ** (i_p + 1)) > 0: break
    ips.append(i_p)
    M_tmp = M_tmp // (p ** i_p)
    if M_tmp == 1: break
else:
    ips.append(1)

#### O(NlogM) below ?
# create memo
## init
if len(ips) > 0: ip_max = max(ips)
else: ip_max = 0
memo = [[None] * N for i in range(ip_max + 1)] # max ip
for j in range(N): memo[0][j] = 1
for i in range(1, ip_max + 1): memo[i][N - 1] = 1
## fill
for i in range(1, ip_max + 1):
    sum_tmp = 0
    vals = list(memo[i - 1])[::-1]
    ptr_memo = memo[i]
    for j, val in enumerate(vals):
        sum_tmp += val
        ptr_memo[N - 1 - j] = sum_tmp
#### O(NlogM) above ?
        
# calculate ans
ans = 1
for i_p in ips:
    ans = (ans * memo[i_p][0]) % (10 ** 9 + 7)

if M == 1: print(1)
elif ip_max < 1: print(N)
else: print(ans)
S = []
for _ in range(h):
  S.append(input())

for i in range(h):
  ss = ''
  for j in range(w):
    if S[i][j] == '#':
      ss += '#'
    else:
      counter = 0
      for k in [-1, 0, 1]:
        for l in [-1, 0, 1]:
          if 0 <= i+k <= h-1 and 0 <= j+l <= w-1 and S[i+k][j+l] == '#':
            counter += 1
      ss += str(counter)
  print(ss)

### FIXED CODE ###

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

S = []
for _ in range(h):
  S.append(input())

for i in range(h):
  ss = ''
  for j in range(w):
    if S[i][j] == '#':
      ss += '#'
    else:
      counter = 0
      for k in [-1, 0, 1]:
        for l in [-1, 0, 1]:
          if 0 <= i+k <= h-1 and 0 <= j+l <= w-1 and S[i+k][j+l] == '#':
            counter += 1
      ss += str(counter)
  print(ss)
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reversre=True)
ans = 0
d = deque(A[0])
for x in A[1:]:
  ans += d.popleft()
  d.append(x)
  d.append(x)
print(ans)

### FIXED CODE ###

from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
d = deque([A[0]])
for x in A[1:]:
  ans += d.popleft()
  d.append(x)
  d.append(x)
print(ans)
import math
def lcm(a, b):
    return a * b / math.gcd(a, b)

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

A_half = [0.5 * a for a in A]
A_lcm = A_half[0]

for i in range(1, N):
    A_lcm = lcm(int(A_lcm), int(A_half[i]))

ans = 0
if (M // 2) % 2 == 0:
    ans = (M // A_lcm) // 2
else:
    ans = (M // A_lcm) // 2 + 1

print(int(ans))

### FIXED CODE ###

from fractions import gcd

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

A_lcm = 1
for i in range(N):
    A_lcm *= A[i] // gcd(A_lcm, A[i])
    
for i in A:
    if A_lcm // i % 2 == 0:
        print(0)
        exit()

print((M // A_lcm + 1) // 2)
s = input()
t = input()
n = len(s)
for i in range(n):
  if i%2:
    print(s[i], end="")
  else:
    print(t[i], end="")
print()

### FIXED CODE ###

s = input()
t = input()
n = len(t)
for i in range(n):
  print(s[i], end="")
  print(t[i], end="")
if len(s) != len(t):
  print(s[-1], end="")
print()
# Dは距離　Tは制限時間　速度はS
D = int(input())
T = int(input())
S = int(input())
if D > T * S:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

# Dは距離　Tは制限時間　速度はS
Information_Lists = input().split()
#.split("文字列")で、文字列ごとに分けることができる。"文字列"を入れないとスペースで分けられる。
D = int(Information_Lists[0])
T = int(Information_Lists[1])
S = int(Information_Lists[2])
if D > T * S:
    print("No")
else:
    print("Yes")
n=int(input())
a=[]
for i in range(n):
	x=int(input())
	a.append(x)
ans=0
for i in range(n-1):
	if a[i]>0:
		ans+=(a[i]//2)
		a[i]-=(a[i]//2)*2
	if a[i]>0:
		a[i+1]-=min(a[i],a[i+1])
		ans+=min(a[i],a[i+1])
if a[-1]>0:
	ans+=a[-1]//2
print(ans)


### FIXED CODE ###

s=input()
S=s.count("S")
E=s.count("E")
N=s.count("N")
W=s.count("W")
a=0
b=0
if S>0 and N>0:
	a+=1
elif S==N==0:
	a+=1
if E>0 and W>0:
	b+=1
elif E==W==0:
	b+=1
if a==b==1:
	print("Yes")
else:
	print("No")
a,b = map(int,input())
if max([a,b]) >= 9:
  print(':(')
else:
  print('Yay!')

### FIXED CODE ###

a,b = map(int,input().split())
if max([a,b]) >= 9:
  print(':(')
else:
  print('Yay!')
n=input()
l=[]
for i in range(n):
  l.apend(int(input()))
print(len(set(l)))
        

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
print(len(set(l)))
n = int(input())
s = input()
i = 0
count = 0

while i < len(s):
    if not (s[i] == 'A'):
        i+=1
        continue
    i+=1
    if not (s[i] == 'B'):
        i+=1
        continue
    i+=1
    if not (s[i] == 'C'):
        i+=1
        continue
    i+=1
    count+=1

print(count)

### FIXED CODE ###

n = int(input())
s = input()
i = 0
count = 0

while i < len(s):
    if not (s[i] == 'A'):
        i+=1
        continue

    i+=1
    if not i < len(s):
        break
    if not (s[i] == 'B'):
        continue

    i+=1
    if not i < len(s):
        break
    if not (s[i] == 'C'):
        continue

    i+=1
    count+=1

print(count)
n = int(input())
s = input()
c = 0
sl = list(s)
sl2 = sl
k = 0
for i in range(n-2):
   if sl[i]=="#" and sl[i+1]==".":
      if sl[i+2]=="." and sl[i-1]==".":
        sl[i]='.'
        c = c + 1
      if sl[i+2]=="." and sl[i-1]=="#":
        sl[i+1]='#'
        sl[i+2]='#'
        c = c + 2
      elif sl[i+2]=='#':
        sl[i+1]='#'
        c = c + 1
if sl[n-2]=="#" and sl[n-1]==".":
  sl[i+1]='#'
  c=c+1
print(c)

### FIXED CODE ###

n = int(input())
s = input()
m = s.count('.')
ans = m
for i in range(n):
  if s[i] == '#':
    m = m + 1
  else:
    m = m - 1
  ans=min(m,ans)
print(ans)
N,M = map(int,input().split())
ans = [0]*M
for i in range(N):
    KA = list(map(int,input().split()))
    for j in range(1,len(KA)):
        ans[[KA[j]-1]] += 1
print(ans.count(N))

### FIXED CODE ###

N,M = map(int,input().split())
ans = [0]*M
for i in range(N):
    KA = list(map(int,input().split()))
    for j in range(1,len(KA)):
        ans[KA[j]-1] += 1
print(ans.count(N))
n , k = map(int, input().split())
a = list(map(int, input().split()))
neg = []
pos = []
mod = 10**9+7
for i in range(n):
    if a[i] >= 0:
        pos.append(a[i])
    else:
        neg.append(a[i])
neg.sort()
pos.sort(reverse = True)
if len(pos) == 0 or n == k:
    print(4/0)
    ans = 1
    a.sort(reverse = True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans % mod)
else:
    #最大化するとき
    from collections import deque
    ans = 1
    neg_new = []
    for i in range(0, len(neg)//2):
        neg_new.append(neg[2*i] * neg[2*i+1])
    neg_new = deque(sorted(neg_new, reverse = True))
    pos = deque(pos)
    if k % 2 == 1:
        k -= 1
        ans = pos.popleft()
    else:
        ans = 1
    while k > 0:
        if len(pos) >= 2 and len(neg_new) >= 1:
            if pos[0] * pos[1] > neg_new[0]:
                ans *= pos.popleft() * pos.popleft()
            else:
                ans *= neg_new.popleft()
        elif len(pos) >= 2:
            ans *= pos.popleft() * pos.popleft()
        else:
            ans *= neg_new.popleft()
        k -= 2
        ans %= mod
    print(ans % mod)

### FIXED CODE ###

n , k = map(int, input().split())
a = list(map(int, input().split()))
neg = []
pos = []
mod = 10**9+7
for i in range(n):
    if a[i] >= 0:
        pos.append(a[i])
    else:
        neg.append(a[i])
neg.sort()
pos.sort(reverse = True)
if (len(pos) == 0 and k % 2 == 1) or n == k:
    ans = 1
    a.sort(reverse = True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans % mod)
else:
    #最大化するとき
    from collections import deque
    ans = 1
    neg_new = []
    for i in range(0, len(neg)//2):
        neg_new.append(neg[2*i] * neg[2*i+1])
    neg_new = deque(sorted(neg_new, reverse = True))
    pos = deque(pos)
    if k % 2 == 1:
        k -= 1
        ans = pos.popleft()
    else:
        ans = 1
    while k > 0:
        if len(pos) >= 2 and len(neg_new) >= 1:
            if pos[0] * pos[1] > neg_new[0]:
                ans *= pos.popleft() * pos.popleft()
            else:
                ans *= neg_new.popleft()
        elif len(pos) >= 2:
            ans *= pos.popleft() * pos.popleft()
        else:
            ans *= neg_new.popleft()
        k -= 2
        ans %= mod
    print(ans % mod)
n,k=map(int,input().split())
ans = [i for i in range(1,n+1)]
for i in range(k):
	a=list(map(int,input()))
	for j in a:
      if j in ans:
        ans.remove(j)
print(len(ans))

### FIXED CODE ###

n,k=map(int,input().split())
ans = [i for i in range(1,n+1)]
for i in range(k):
  input()
  a=list(map(int,input().split()))
  for j in a:
    if j in ans:
      ans.remove(j)
print(len(ans))
N=int(input())

def solve(n):
  cnt_len=0
  cnt_fact=2
  cnt_sum=0
  ans=[]

  while cnt_len < n:
    if cnt_fact%2==0 or cnt_fact%3==0:
      ans.append(cnt_fact)
      cnt_len+=1
      cnt_sum+=cnt_fact
    cnt_fact+=1
    
  res = cnt_sum % 6
  cnt_fact=((cnt_fact)//6+1)*6
  
  if res==0:
    return ans
  elif res==1:
    ans[2]=cnt_fact+3
    return ans
  elif res==2:
    ans[4]=cnt_fact
    return ans
  elif res==3:
    ans[3]=cnt_fact+3
    return ans
  elif res==4:
    ans[4]=cnt_fact+4
    return ans
  else:
    cnt[4]=cnt_fact+3
    return ans
  
if N==3:
  print(2,5,63)
elif N==4:
  print(2,5,20,63)
elif N==5:
  print(2,3,4,6,9)
else:
  A=solve(N)
  print(*A)

### FIXED CODE ###

N=int(input())

if N == 3:
    print("2 5 63")
    import sys
    sys.exit()
    
ans=[]
for i in range(3,30001):
  if len(ans)==N-1:
    break
  if i%2==0 or i%3==0 or i%5==0:
    ans.append(i)

s=sum(ans)

if s%2==1:
  ans[0]=2
  s=sum(ans)

ans.append(30000 - s%30)

print(*ans)
s = str(input())
if s = "Sunny":
	print("Cloudy")
elif s = "Cloudy":
	print("Rainy")
else:
	print("Sunny")

### FIXED CODE ###

s = str(input())
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
a,b,c=map(int,intput().split())
print((a*b)//2)


### FIXED CODE ###

a,b,c=map(int,input().split())
print((a*b)//2)
n = int(input())
A = list(map(int,input().split()))
counter = 0
end_judge = 0
while 1:
  
  for i in range(n):
    if A[i]%2 == 1:
      end_judge = 1
    else:
      A[i] = A[i] % 2    
      
  counter += 1
  if end_judge == 1:
    break

### FIXED CODE ###

li = list(input())
count = 0
for i in range(3):
  if li[i] == '1':
    count += 1
print(count)
from functools import reduce
from math import gcd


def main():
    cookies = list(map(int, input().split()))
    answer = -1
    if cookies[0] % 2 or cookies[1] % 2 or cookies[2] % 2:
        answer = 0
    elif len(set(cookies)) > 1:
        answer = reduce(gcd, cookies) - 1
    print(answer)


if __name__ == '__main__':
    main()



### FIXED CODE ###

def main():
    cookies = list(map(int, input().split()))
    answer = 0
    if cookies[0] == cookies[1] == cookies[2] and cookies[0] % 2 == 0:
        answer = -1
    elif all(cookies[i] % 2 == 0 for i in range(3)):
        half = [0, 0, 0]
        sum_cookies = sum(cookies)
        while all(cookies[i] % 2 == 0 for i in range(3)):
            for i in range(3):
                half[i] = (sum_cookies - cookies[i]) // 2
            cookies[0] = half[1] + half[2]
            cookies[1] = half[0] + half[2]
            cookies[2] = half[1] + half[0]
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()
import numpy as np
n=int(input())
a=list(map(int, input().split()))

if np.gcd.reduce(a) != 1:
    print('not coprime')
    exit()

N=max(a)+1
A=list(range(2,N))
p=list()

while A[0]**2<=N:
	tmp=A[0]
	p.append(tmp)
	A=[e for e in A if e%tmp!=0]
l=p+A

#print(l)
for i in range(len(a)):
    count=0
    for j in range(len(l)):
        if a[i]%l[j]==0:
            count+=1
            if count > 1:
                print('setwise coprime')
                exit() 
    #print(count) 

print('pairwise coprime')

### FIXED CODE ###

import numpy as np
n=int(input())
a=list(map(int, input().split()))

if np.gcd.reduce(a) != 1:
    print('not coprime')
    exit()

m=max(a)
cnt=[0]*(m+1)

for i in range(len(a)):
    cnt[a[i]]+=1
#print(cnt)
for i in range(2, m + 1):
    #print(cnt[i::i])
    if sum(cnt[i::i]) > 1:
        print('setwise coprime')
        exit()

print('pairwise coprime')
N,A,B=map(int,input().split())
i=(N//(A+B))*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(i)

### FIXED CODE ###

S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')
import sys

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

A = []
for i in range(W):
    A.append(list(input()))

# print(A)
for r in range(H):
    for line in range(W):
        # print(r, line)
        if(A[r][line] != "#"):
            continue

        # print(r, line, A[r][line])

        if(line == 0 or W == 1):
            L = False
        else:
            L = A[r][line - 1] == "#"

        if(r == 0 or H == 1):
            U = False
        else:
            U = A[r - 1][line] == "#"

        if(line == W - 1 or W == 1):
            R = False
        else:
            R = A[r][line + 1] == "#"

        if(r == H - 1 or H == 1):
            D = False
        else:
            D = A[r + 1][line] == "#"

        # print(L, U, R, D)
        # print(L or U or R or D)
        if((L or U or R or D) is False):
            print("No")
            sys.exit()

print("Yes")

### FIXED CODE ###

import sys

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

A = []
for i in range(H):
    A.append(list(input()))

# print(A)
for r in range(H):
    for line in range(W):
        # print(r, line)
        if(A[r][line] != "#"):
            continue

        # print(r, line, A[r][line])

        if(line == 0 or W == 1):
            L = False
        else:
            L = A[r][line - 1] == "#"

        if(r == 0 or H == 1):
            U = False
        else:
            U = A[r - 1][line] == "#"

        if(line == W - 1 or W == 1):
            R = False
        else:
            R = A[r][line + 1] == "#"

        if(r == H - 1 or H == 1):
            D = False
        else:
            D = A[r + 1][line] == "#"

        # print(L, U, R, D)
        # print(L or U or R or D)
        if((L or U or R or D) is False):
            print("No")
            sys.exit()

print("Yes")
H,W=map(int,input())
h,w=map(int,input())
print((H-h)*(W-w))

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
a,b,k = map(int, input().split())
num_list = [i for i in range(a,b+1)]
res = []
if k > b:
    k = b-1
for i in range(k):
    res.append(num_list[i])
    res.append(num_list[-(i+1)])

for s in sorted(set(res)):
    print(s)

### FIXED CODE ###

import math
a,b,k = map(int, input().split())
res = []
if 2*k > b-a:
    k = math.ceil((b-a)/2)+1
for i in range(k):
    res.append(a+i)
    res.append(b-i)

for s in sorted(set(res)):
    print(s)
N, K = map(int, input().split())
S = list(input())

l = []
for i in range(N):
  if i == 0:
    tmp = i
  elif S[i - 1] != S[i]:
    l.append([tmp, i - 1, i - tmp])
    tmp = i
  elif i == N - 1:
    l.append([tmp, i, i - tmp + 1])

for k in range(K):
  i = 2 * k + 1
  if S[l[i][0]] == "L":
    S[l[i][0] : l[i][1] + 1] = "R" * l[i][2]
  else:
    S[l[i][0] : l[i][1] + 1] = "L" * l[i][2]

ans = 0
for i in range(N - 1):
  if S[i] == S[i + 1]:
    ans += 1

print(ans)

### FIXED CODE ###

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

l = []
tmp = 0
for i in range(1, N):
  if S[i - 1] != S[i]:
    l.append([tmp, i - 1, i - tmp])
    tmp = i
  if i == N - 1:
    l.append([tmp, i, i - tmp + 1])

for k in range(K):
  i = 2 * k + 1
  if i >= len(l):
    break
  if S[l[i][0]] == "L":
    S[l[i][0] : l[i][1] + 1] = "R" * l[i][2]
  else:
    S[l[i][0] : l[i][1] + 1] = "L" * l[i][2]

ans = 0
for i in range(N - 1):
  if S[i] == S[i + 1]:
    ans += 1

print(ans)
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
broken_steps = [int(input()) for _ in range(m)]
#print(broken_steps)

def ptn_num(x): # 'x'stepまでのパターン数
    if x == 1:
        return 1
    else:
        dp = [0] * (x+1) # DP枠_including step'0'
        cnt = 0
        if broken_steps[0] == 1: # in case, step'1' broken 
            dp[:2] = 1, 0
        else:
            dp[:2] = 1, 1 # Usually

        for i in range(2, x+1):
            if i in broken_steps: # 階段が壊れている場合...
                cnt += 1
                if cnt == 2:
                    print(0)
                    exit()
            else: # 階段が壊れてない場合...
                tmp = (dp[i-1] + dp[i-2]) % (10**9+7)
                dp[i] = tmp
                cnt = 0
        
        return dp[-1]

print(ptn_num(n))


### FIXED CODE ###

n, m = map(int, input().split())
a = set(map(int, [input() for _ in range(m)]))

dp = [0] * (n+1)
# 0段目と1段目は1通り（但し、１段目が壊れていない場合）（0 段目は「なにもしない」という から1 通り）
dp[:2] = 1, 1 if 1 not in a else 0 

for i in range(2, n+1):
    if i in a:
        continue
    else:
        dp[i] = (dp[i-1] + dp[i-2])

print(dp[-1] % (10**9+7))
a = []
for i in range(5):
  a.append(int(input()))
k = int(input())

ans = "Yay!"
for i in range(4):
  for j in range(i+1, 5):
  	if a[i] - a[j] > k:
    	ans = ":("
    
print(ans)

### FIXED CODE ###

a = []
for i in range(5):
  a.append(int(input()))
k = int(input())

if a[4] - a[0] <= k:
  print("Yay!")
else:
  print(":(")
s = input()
n = len(s)

res = 0

def part_sum(cur, i):
  if i != n:
    res += part_sum(cur+s[i], i+1)
    res += part_sum(cur+s[i]+"+", i+1)
  else:
    cur += s[i]
    return sum(list(map(int, cur.split("+")))) 
  
part_sum("", 0)
print(res)

### FIXED CODE ###

s = input()
n = len(s)

def part_sum(cur, i, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, res)
        part_sum(cur+s[i]+"+", i+1, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
    return res
  
res = part_sum("", 0, [])
print(sum(res))
def kaijou2(num):
  return kaijou(num,1)
def kaijou(num,ac):
  if (num == 0):
    return ac
  else:
    return kaijou(num - 1,(ac * num) % (10 ** 9 + 7))

[n,m] = list(map(int,input().split()))
x = abs(n - m)
ans = 0
if (x >= 2):
  ans = 0
elif (x == 1):
  ans = (kaijou2(m) * kaijou2(n)) % (10 ** 9 + 7)
elif (x == 0):
  ans = (kaijou2(m) * kaijou2(n) * 2) % (10 ** 9 + 7)
print(ans)


### FIXED CODE ###

def kaijou(num):
  ac = 1
  for i in range(num):
    ac = ((i + 1) * ac) % (10 ** 9 + 7)
  return ac
[n,m] = list(map(int,input().split()))
x = abs(n - m)
ans = 0
if (x >= 2):
  ans = 0
elif (x == 1):
  ans = (kaijou(m) * kaijou(n)) % (10 ** 9 + 7)
elif (x == 0):
  ans = (kaijou(m) * kaijou(n) * 2) % (10 ** 9 + 7)
print(ans)
a,b,c=map(int,input().split())

if a=b and b=c :
    print("Yes")
else:
    print('No') 

### FIXED CODE ###

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

if a==b and b==c :
    print('No')
elif a==b or a==c or b==c:
    print("Yes")
else:
    print('No')
%import numpy as np
c1 = [int(i) for i in input().split()]
c2 = [int(i) for i in input().split()]
c3 = [int(i) for i in input().split()]
s = sum(c1) + sum(c2) + sum(c3)
print('Yes' if s % 3 == 0 else 'No')

### FIXED CODE ###

N = int(input())
A = int(input())
print('Yes' if int(N % 500) <= A else 'No')
s = input()
k = int(input())
for i, c in enumerate(s):
    if int(c)>1:
        ind = i+1
        n = int(c)
        break

if k<ind:
    print(1)
else:
    print(n)

### FIXED CODE ###

s = input()
k = int(input())
for i, c in enumerate(s):
    if int(c)>1:
        if k<i+1:
            print(1)
        else:
            print(int(c))
        break
else:
    print(1)
import math

a, b, x = [int(v) for v in input().split(' ')]

l1 = x / (a * a)
l2 = b - l1

if a * a * b / 2.0 <= x:
    tan2 = (a / 2) / l2
    rad2 = math.atan(tan2)
    print(90 - math.degrees(rad2))
else:

    tan3 = (2 * x) / (a * b * b)
    print(90-math.degrees(math.atan(tan3)))


### FIXED CODE ###

import math

a, b, x = [int(v) for v in input().split(' ')]


if a * a * b / 2.0 <= x:
    l = b - (x / (a * a))
    tan = l / (a / 2)
    print(math.degrees(math.atan(tan)))
else:
    tan = (2 * x) / (a * b * b)
    print(90-math.degrees(math.atan(tan)))
def resolve():
    from operator import add
    N = int(input())
    list = list(map(int, input().split()))
    ans = reduce(add, (list))
    print(ans if ans <= 10**18 else "-1")
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print(0)
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)
resolve()
s = list(input())
leng = len(s)
tmp = "R"
lis = [0]*(leng)

for i in range(1,leng):
    if s[i] == "L":
        if tmp == "R":
            s[i] = "G"
            tmp = "L"
        else:
            tmp = "L"
    else:   #s[i] =="R"
        tmp = "R"

def count(num,locat):
    if s[locat] == "L":
        num += 1
        count(num,locat-1)
    if s[locat] == "R":
        num += 1
        count(num,locat+1)
    if s[locat] == "G":
        if num%2 == 0:
            lis[locat] += 1
        else:
            lis[locat-1] += 1

for i in range(leng):
    count(0,i)

print (*lis)

### FIXED CODE ###

import math
import sys
sys.setrecursionlimit(100000)

#S     G     S
#RRR..RLL...LRR...

s = list(input())
leng = len(s)
tmp = "R"
s[0] = "S"

for i in range(1,leng):
    if s[i] == "L":
        if tmp == "R":
            s[i] = "G"
        tmp = "L"
    else:
        if tmp == "L":
            s[i] = "S"
        tmp = "R"
lis = [0]*(leng)
tmp_s = 0
tmp_g = leng - 1

for i in range(1,leng):
    if s[i] == "G":
        tmp_g = i
    if s[i] == "S" or i == leng-1:
        if i == leng-1:
            i += 1
        if (tmp_g - tmp_s) % 2 == 0:
            lis[tmp_g-1] = math.floor((i - tmp_s)/2)
            lis[tmp_g] = math.floor((i - tmp_s)/2 + 0.5)
        else:
            lis[tmp_g-1] = math.floor((i - tmp_s)/2 + 0.5)
            lis[tmp_g] = math.floor((i - tmp_s)/2)
        tmp_s = i
        continue

    continue

print (*lis)