Harryxun/stf_run huggingface dataset:
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f ==r -1:
        break

    if m + f  <= 80:
        return 'A'

    if m + f <= 60 and m + f > 80:
        return 'B'

    if m + f <= 50 and m + f > 65:
        return 'C'

    if m + f <= 30 and m + f  >50:
        return 'D'

    if r <= 50:
        return 'C'

    else:
        return 'F'

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')
        
    elif total < 80:
        print('B')

    else:
        print('A')
a,b,c,d=(map(int,input().split())
if abs(a-b)<=d:
         print("Yes")
elif abd(a-c)<=d and abs(b-c)<=d:
         print("Yes")
else:
         print("No")
         


### FIXED CODE ###

a,b,c,d=map(int,input().split())
print("Yes" if abs(a-c)<=d or abs(a-b)<=d and abs(c-b)<=d else "No")
# -*- coding:utf-8 -*-

n = int(raw_input())
numlist = (raw_input()).split(' ')

count = 0

i = 0
while (int(numlist[i]) == 0):
 i += 1

if (int(numlist[0]) == 0):
    if (int(numlist[i]) > 0):
        numlist[0] = (-1) ** i
    else:
        numlist[0] = (-1) ** (i+1)
    count += 1

sumlist = [int(numlist[0])]

for i in range(1, n):
  sumlist.append(sumlist[i-1] + int(numlist[i]))
  while (True):
    if (sumlist[i-1] > 0 and sumlist[i] > 0):  #i-1,i番目までのsumがともに正
      numlist[i] = int(numlist[i]) - (sumlist[i] + 1)
      count += sumlist[i] + 1
      sumlist[i] = -1
    elif (sumlist[i-1] < 0 and sumlist[i] < 0):  #i-1,i番目までのsumがともに負
      numlist[i] = int(numlist[i]) + ((-1)*sumlist[i] + 1)
      count += (-1)*sumlist[i] + 1
      sumlist[i] = 1
    elif (sumlist[i] == 0):  #i番目までのsum=0
      if (sumlist[i-1] > 0):
        numlist[i] = int(numlist[i]) - 1
        sumlist[i] -= 1
      if (sumlist[i-1] < 0):
        numlist[i] = int(numlist[i]) + 1
        sumlist[i] += 1
      count += 1
    else:
      break
    #print numlist
    #print sumlist

print count


### FIXED CODE ###

# -*- coding:utf-8 -*-

sA = raw_input()
sB = raw_input()

A = int(sA)
B = int(sB)

if (A > B):
  print 'GREATER'
elif (A < B):
  print 'LESS'
else:
  print 'EQUAL'
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-2
    ans=0

    for i in range(k):
        ans+=pot
        pot-=1
    print(ans)


### FIXED CODE ###

n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-1
    m = k*b
    high = m+a
    low = a*k + b
    print(high-low+1)
s=input()
if s==‘Sunny’:
    print(‘Cloudy’)
elif s==‘Cloudy’:
    print(‘Rainy’)
elif s==‘Rainy’:
    print(‘Sunny’)

### FIXED CODE ###

S=input()
if S=="Rainy":
  print("Sunny")
if S=="Sunny":
  print("Cloudy")
if S=="Cloudy":
  print("Rainy")
import math

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

dp = [math.inf] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, n):
    one = abs(h[i] - h[i-1]) + dp[i-1]
    two = abs(h[i] - h[i-2]) + dp[i-2]
    dp[i] = min(one, two)
print(dp[n-1])

### FIXED CODE ###

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, n):
    one = abs(h[i] - h[i-1]) + dp[i-1]
    two = abs(h[i] - h[i-2]) + dp[i-2]
    dp[i] = min(one, two)
print(dp[n-1])
from math import factorial

N,A,B,K = map(int, raw_input().split())
mod=998244353

def product(iterable):
    prod = 1
    for n in iterable:
        prod *= n
    return prod

def npr(n, r):
    return product(range(n - r + 1, n + 1))

def ncr(n, r):
    if r > n // 2:
        r = n - r
    return npr(n, r) // factorial(r)

if K==0: print 1;quit()

y=0
ans=0
for x in range(1,N+1):
	if (K-A*x)%B==0:
		y=(K-A*x)/B
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans

### FIXED CODE ###

N,A,B,K = map(int, raw_input().split())


mod=998244353
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, N+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))


def ncr(n,r):
	if n < 0 or r < 0 or n < r:
		return 0
	else:
		return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

y=0
ans=0
for x in range(N+1):
	if (K-A*x)%B==0:
		if K-A*x<0: break
		y=(K-A*x)/B
		if y>N: continue
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans%mod
a, b, c, x, y = list(map(int, input().split()))
res = a * x + b * y
for i in range(1, max(x, y) + 1):
    res = min(res, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i)
print(res)

### FIXED CODE ###

S = input().rstrip()
print(700 + S.count("o")*100)
_ = input()
l = list(map(int, input().split(" ")))

ans = functools.reduce(lambda x, y : x* y, l, 1)

if ans > 10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###


import sys
_ = input()
l = list(map(int, input().split(" ")))

if 0 in l:
    print(0)
    sys.exit()

ans = 1
for i in l:
    ans *= i
    if ans > 10 **18:
        print(-1)
        sys.exit()

print(ans)
import scipy.misc as scm
mod = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
   print(scm.comb(len(a), k, True) % mod - scm.comb(l+len(a)-r-1, k-1, True) % mod)

### FIXED CODE ###

# ------ combination -------
N, MOD = 10**5 + 1, 10**9 + 7
fc, ifc = [0] * (N+1), [0] * (N+1)

def power(n, a):
    res, exp = 1, n
    while(a):
        if a & 1:
            res = res * exp % MOD
        exp = exp * exp % MOD
        a = a >> 1
    return res

fc[0] = 1
for i in range(1, N+1):
    fc[i] = fc[i-1] * i % MOD
ifc[N] = power(fc[N], MOD-2)
for i in range(N-1, -1, -1):
    ifc[i] = ifc[i+1] * (i+1) % MOD

def Comb(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fc[n] * ifc[r] % MOD * ifc[n-r] % MOD

# --------------------------

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

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
    ans = Comb(len(a), k) - Comb(l+len(a)-r-1, k-1)
    while ans < 0:
        ans += MOD
    print(ans)
N=int(input())
*p,=map(float,input().split())
dp=[[0]*(N+1) for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
    for j in range(N+1):
        dp[i][j]=dp[i-1][j]*(1-p[i-1])
        dp[i+1][j+1]+=dp[i][j]*p[i]

print(sum(dp[N][i] for i in range(N+1) if 2*i>=N))

### FIXED CODE ###

N=int(input())
*p,=map(float,input().split())
dp=[[0 for _ in range(N+1)] for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
    for j in range(N+1):
        if j:
            dp[i][j]=dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1]
        else:
            dp[i][j]=dp[i-1][j]*(1-p[i-1])

t=N//2+1 if N%2 else N//2
ans=0
for i in range(t,N+1):
    ans+=dp[N][i]

print(ans)
N = int(input())
amari = N % 1000
if amari ==0:
  print(amari)
elif:
  print(1000-amari)

### FIXED CODE ###

N = int(input())
N = N % 1000
if N == 0:
    ans = 0
else:
    ans = 1000 - N
print(ans)
a=int(input())a\
b=input()
c=0
for i in range(a-1):
  if b[i]==b[i+1]:
    c=c+1
print(a-c)

### FIXED CODE ###

a=int(input())
b=input()
c=0
for i in range(a-1):
  if b[i]==b[i+1]:
    c=c+1
print(a-c)
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, K = MAP()

    r = N%K
    if r == 0:
        print(0)
    else:
        if 2*r > K:
            print(abs(r - K))
        else:
            print(r)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, K = MAP()

    r = N%K
    if r == 0:
        print(0)
    else:
        if 2*r > K:
            print(abs(r - K))
        else:
            print(r)


if __name__ == '__main__':
    main()
s=a*b
print(s)


### FIXED CODE ###

s = raw_input().split()
a = int(s[0])
b = int(s[1])
print("{0} {1}".format(a*b, 2*(a+b)))
n,m=map(int, input().split())
print(Yes if n==m else No)

### FIXED CODE ###

n,m=map(int, input().split())
print('Yes' if n==m else 'No')
import sys
sys.setrecursionlimit(5000)
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(lambda x: int(x)-1, input().split())
    G[x].append(y)

# iを始点としたときの有効パスの最大長さ
dp = [-1] * n

def rec(s):
    if dp[s] != -1:
        return dp[s]
    
    ret = 0
    for ns in G[s]:
        ret = max(ret, rec(ns)+1)
    dp[s] = ret
    return ret

ml = 0    
for i in range(n):
    ml = max(ml, rec(i))

print(ml)


### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(lambda x: int(x)-1, input().split())
    G[x].append(y)

# iを始点としたときの有効パスの最大長さ
dp = [-1] * n
 
def rec(s):
    if dp[s] != -1:
        return dp[s]

    ret = 0
    for ns in G[s]:
        ret = max(ret, rec(ns)+1)
    dp[s] = ret
    return ret

ml = 0    
for i in range(n):
    ml = max(ml, rec(i))
print(ml)
S = input()

cout = 0
for i in range(0,len(S)):
    if S[i] == '1':
        cout += 1

return cout

### FIXED CODE ###

S = input()

cout = 0
for i in range(0,len(S)):
    if S[i] == '1':
        cout += 1

print(cout)
from math import gcd
a,b,c,d=map(int,input().split())
f=b//c - (a-1)//c
g=b//d - (a-1)//d
k=c*d//gcd(c,d)
h=f+g-(b//k-(a-1)//k)
print(b-a)

### FIXED CODE ###

from fractions import gcd
a,b,c,d=map(int,input().split())
f=b//c - (a-1)//c
g=b//d - (a-1)//d
k=c*d//gcd(c,d)
h=f+g-(b//k-(a-1)//k)
print((b+1-a)-h)
import math
import sympy

def kai(n):
    return math.factorial(n)

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

prime = sympy.factorint(M)

ans = 1
for v in prime.values():
    ans  =  ans * (kai(N+v-1)/(kai(v)*kai(N-1)))

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

### FIXED CODE ###

import math

def prime_factor2(n):
    i = 2
    factors = {}
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
    if n > 1:
        if n in factors:
            factors[n] += 1
        else:
            factors[n] = 1
    return factors

def kai(n):
    return math.factorial(n)

def H(n, r):
    rtn = 1
    for i in range(n+r-1, n-1, -1):
        rtn *= i
    rtn //= kai(r)
    return rtn


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

prime = prime_factor2(M)

ans = 1
for v in prime.values():
    h = H(N, v) % (10**9 + 7)
    ans  =  ans * h

ans = ans % (10**9 + 7)
ans = int(ans)
print(ans)
n, k = map(int, input().split())
s = input()
one = [i.count('1') for i in s.split('0') if i.count('1') > 0]
zero = [i.count('0') for i in s.split('1') if i.count('0') > 0]
if s[0] == '0':
    a = sum(one[:k]+zero[:k])
    rslt = a
    for i in range(k, len(zero)):
        if len(zero) > len(one) and i == len(zero)-1:
            a += zero[i]
            a -= zero[i-k]
            rslt = max(rslt, a)
        else:
            a += one[i] + zero[i]       
            a -= one[i-k] + zero[i-k]
            rslt = max(rslt, a)
else:
    a = sum(one[:k+1]+zero[:k])
    rslt = a
    for i in range(k, len(zero)):
        a += one[i+1]+zero[i]
        a -= one[i-k] + zero[i-k]
        rslt = max(rslt, a)
print(rslt)
    

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
l = []
c = 1
for i in range(n - 1):
    if s[i] != s[i + 1]:
        l.append(c)
        c = 0
    c += 1
l.append(c)
l += [0]
if s[0] == '0':
    l = [0] + l
tmp = sum(l[:2 * k + 1])
rslt = tmp
for i in range(0, len(l) - 2*k-2, 2):
    tmp = tmp - l[i] - l[i + 1] + l[i + 2 * k + 1] + l[i + 2 * k + 2]
    rslt = max(tmp, rslt)
print(rslt)
x=int(input())
y=int(input())

print(x*y end=""2*(x*y))

### FIXED CODE ###

x,y=map(int,input().split())
print (x*y,2*(x+y))
n = int(input())
dic = ()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')



### FIXED CODE ###

n = int(input())
dic = set()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')
def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())

    r1m = max([c11, c12, c13])
    r2m = max([c21, c22, c23])
    r3m = max([c31, c32, c33])
    c1m = max([c11, c21, c31])
    c2m = max([c12, c22, c32])
    c3m = max([c13, c23, c33])
    a = [(a1, a2, a3) for a1 in range(0, r1m + 1) for a2 in range(0, r2m + 1) for a3 in range(0, r3m + 1)]
    m = max(a)
    b = [(b1, b2, b3) for b1 in range(0, c1m - m + 1) for b2 in range(0, c2m - m + 1) for b3 in range(0, c3m - m + 1)]

    for a1, a2, a3, b1, b2, b3 in a, b:
        if (a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33
            and a1 + b1 == c11 and a2 + b1 == c21 and a3 + b1 == c31
                and a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33):
            print('Yes')
            return

    #                                if a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33:
    #                                    print('Yes')
    #                                    return

    #            m = max([a1, a2, a3])
    #            for b1 in range(0, c1m - m + 1):
    #                if a1 + b1 == c11 and a2 + b1 == c21 and a3 + b1 == c31:
    #                    for b2 in range(0, c2m - m + 1):
    #                        if a1 + b2 == c12 and a2 + b2 == c22 and a3 + b2 == c32:
    #                            for b3 in range(0, c3m - m + 1):
    #                                if a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33:
    #                                    print('Yes')
    #                                    return

    print('No')
    return


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())

    r1max = max([c11, c12, c13])
    r2max = max([c21, c22, c23])
    r3max = max([c31, c32, c33])
    c1max = max([c11, c21, c31])
    c2max = max([c12, c22, c32])
    c3max = max([c13, c23, c33])
    for a1 in range(0, r1max + 1):
        for a2 in range(0, r2max + 1):
            for a3 in range(0, r3max + 1):
                m = max([a1, a2, a3])
                for b1 in range(0, c1max - m + 1):
                    C11 = a1 + b1
                    C21 = a2 + b1
                    C31 = a3 + b1
                    if C11 == c11 and C21 == c21 and C31 == c31:
                        for b2 in range(0, c2max - m + 1):
                            C12 = a1 + b2
                            C22 = a2 + b2
                            C32 = a3 + b2
                            if C12 == c12 and C22 == c22 and C32 == c32:
                                for b3 in range(0, c3max - m + 1):
                                    C13 = a1 + b3
                                    C23 = a2 + b3
                                    C33 = a3 + b3
                                    if C13 == c13 and C23 == c23 and C33 == c33:
                                        print('Yes')
                                        return

    print('No')
    return


if __name__ == '__main__':
    main()
n,m,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
b = sum(B)
ka = k
i = m
re = 0
for a in A:
  if ka < 0:
    break
  while ka < b and i > 0:
    b -= B[i]
    i -= 1
  ka -= a
  re += 1
  
print(re+i)

### FIXED CODE ###

n,m,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
b = sum(B)
ka = k
i = m
c = 0
re = 0
A.insert(0, 0)
for a in A:
  ka -= a
  if ka < 0:
    break
  while ka < b and i > 0:
    i -= 1
    b -= B[i]
  c += 1
  re = max(re, c+i)

  
print(re-1)
A, B, C = map(int, input().split())
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')


### FIXED CODE ###

A, B, C = input().split()
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')
import sys

nmlist = list(map(int, input().split()))
N = nmlist[0]
M = nmlist[1]
order_list = [list(map(int, input().split())) for _ in range(M)]

cnt = 0

for k in range(M):
    if order_list[k] == [1,0]:
        cnt += 1

if cnt == M:
    print(0)
    sys.exit()

for j in range(M):
    if order_list[j][0] > N:
        print(-1)
        sys.exit()
    if order_list[j][0] == 1 and order_list[j][1] == 0:
        print(-1)
        sys.exit()

for i in range(M):
    if Number[order_list[i][0]-N+2] != 0 and Number[order_list[i][0]-N+2] != order_list[i][1]:
        print(-1)
        sys.exit()
    Number[order_list[i][0]-N+2] = order_list[i][1]

if Number[3-N] == 0:
    Number[3-N] = 1

print(100*Number[0]+10*Number[1]+Number[2])

### FIXED CODE ###

import sys
 
nmlist = list(map(int, input().split()))
N = nmlist[0]
M = nmlist[1]
order_list = [list(map(int, input().split())) for _ in range(M)]
 
Number = [0,0,0]
cnt = 0

for k in range(M):
    if N==1 and order_list[k] == [1,0]:
        cnt += 1
 
if cnt == M and cnt>0:
    print(0)
    sys.exit()
for j in range(M):
    if order_list[j][0] > N:
        print(-1)
        sys.exit()
    if order_list[j][0] == 1 and order_list[j][1] == 0:
        print(-1)
        sys.exit()
 
for i in range(M):
    if Number[order_list[i][0]-N+2] != 0 and Number[order_list[i][0]-N+2] != order_list[i][1]:
        print(-1)
        sys.exit()
    Number[order_list[i][0]-N+2] = order_list[i][1]
 
if N == 1 and Number[0]+Number[1]+Number[2] == 0:
    print(0)
    sys.exit()
 
if Number[3-N] == 0:
    Number[3-N] = 1
 
print(100*Number[0]+10*Number[1]+Number[2])
A = int(input())
B = int(input())
A&B = [A,B]
a&b&c = [1, 2, 3]
C = set(A&B) ^ set(a&b&c)
print(C)

### FIXED CODE ###

A = int(input())
B = int(input())
C = 6 - A - B
print(C)
N, K = map(int, input().split())

C = N-K+1
D = 1
for i in range(1, K+1):
    if N-K+1 < i:
        print(0)
    else:
        ans = (C*D)%(10**9+7)
        print(ans)
    #print(C,D)
    C = C*(N-K-i+1)//(i+1)
    D = D*(K-i)//i


### FIXED CODE ###

S = list(input())
for i in range(4):
    if not S.count(S[i]) == 2:
        print('No')
        exit()

print('Yes')
# D

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import breadth_first_order

N, M = list(map(int, input().split()))
ABs = np.array([list(map(int, input().split())) for i in range(M)])

row = ABs.T[0]
col = ABs.T[1]
data = [1] * (M)

csr = csr_matrix((data, (row, col)), shape=(N, N))
_, proc = breadth_first_order(csr, 0, directed=False)

if -9999 in proc[1:]:
  print('No')
else:
  print('Yes')
  print('\n'.join((proc[1:]+1).astype('str')))

### FIXED CODE ###

# D

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import breadth_first_order

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

row = []
col = []
for i in range(M):
    r, c = list(map(int, input().split()))
    row.append(c-1)
    col.append(r-1)

data = [1] * (M)

csr = csr_matrix((data, (row, col)), shape=(N, N))
_, proc = breadth_first_order(csr, 0, directed=False)

if -9999 in proc[1:]:
  print('No')
else:
  print('Yes')
  print('\n'.join((proc[1:]+1).astype('str')))
n = int(input())
al = list(map(int,input().split()))
al_p = 1

for i in range(n):
    al_p *= al[i]
    if al_p > 10*18:
        print(-1)
        return
        
print(al_p)

### FIXED CODE ###


def main():
    n = int(input())
    al = list(map(int,input().split()))
    al_p = 1

    if 0 in al:
        print(0)
        return

    for i in range(n):
        al_p *= al[i]
        if al_p > 10**18:
            print(-1)
            return
        
    print(al_p)

main()
from sys import stdin
#T = int(stdin.readline())
S = stdin.readline()

if S == 'AAA' or S == 'BBB':
    return False
else
    return True


### FIXED CODE ###

from sys import stdin
#T = int(stdin.readline())
S = stdin.readline().strip()

if S == "AAA" or S == "BBB":
    print('No')
else:
    print('Yes')
import sys
sys.setrecursionlimit(1000000)

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n,r,q):
    if r==1:
        return n%q

    return (n*combination(n-1,r-1,q)*modinv(r,q))%q

def _input():
    return list(map(int, input().split()))

def main():
    i=_input()
    x,y=i[0],i[1]
    if (2*y-x)%3==0 and (2*x-y)%3==0:
        n=(2*y-x)/3
        m=(2*x-y)/3
        print(int(combination(n+m,n,1000000007)))
    else:
        print(0)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n,r,q):
    if r==0:
        return 1

    return ((n*combination(n-1,r-1,q)%q)*modinv(r,q))%q

def _input():
    return list(map(int, input().split()))

def main():
    i=_input()
    x,y=i[0],i[1]
    if 2*y>=x and 2*x>=y and (2*y-x)%3==0 and (2*x-y)%3==0:
        n=(2*y-x)//3
        m=(2*x-y)//3
        print(int(combination(n+m,min(m,n),1000000007)))
    else:
        print(0)

if __name__ == "__main__":
    main()
a, b, c, d = map(int, input().split())
print(min(a, b) + min(c, d))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a, b) + min(c, d))
a, b = map(int, input(),split())
print(a * b)

### FIXED CODE ###

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