Harryxun/stf_run huggingface dataset:
N, M =map(int,input().split())
ans=0

def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)

if abs(N-M)>=2:
    print(0)
elif abs(N-M)==0:
    ans=fact(N)*4
elif abs(N-M)==1:
    ans=fact(N)*fact(M)
else:
    print(0)

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

print(ans)

### FIXED CODE ###

import math
N, M =map(int,input().split())
ans=0

if abs(N-M)==0:
    ans=math.factorial(N)*math.factorial(M)*2
elif abs(N-M)==1:
    ans=math.factorial(N)*math.factorial(M)
else:
    ans=0

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

print(ans)
counter = 1
while True:
    x = int(input())
    if x == 0
        break
    else :
        print("Case%d%d.format(counter,x))
        counter = counter + 1
        


### FIXED CODE ###

ans = []
for i, x in enumerate(open(0).readlines()):
    ans.append("Case %d: %s" % (i+1, x))
open(1,'w').writelines(ans[:-1])
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
m = n//2
ca = Counter(a)

if n % 2 == 0 and all(ca[i*2 + 1] == 2 for i in range(m)):
    ans = 2 ** m % (1e9 + 7)
    print(int(ans))
elif n % 2 == 1 and ca[0] == 1 and all(ca[(i+1)*2] == 2 for i in range(m)):
    ans = 2 ** m % (1e9 + 7)
    print(int(ans))
else:
    print(0)


### FIXED CODE ###


from collections import Counter

n = int(input())
a = list(map(int, input().split()))
m = n // 2
ca = Counter(a)

if n % 2 == 1 and ca[0] == 1 and all(ca[(i+1)*2] == 2 for i in range(m)):
    ans = (2 ** m) % (10 ** 9 + 7)
    print(ans)
elif n % 2 == 0 and all(ca[i*2 + 1] == 2 for i in range(m)):
    ans = (2 ** m) % (10 ** 9 + 7)
    print(ans)
else:
    print(0)
import math

def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

d={'M':0,'A':0,'R':0,'C':0,'H':0}
n=int(input())
for i in range(n):
  word=input()
  if word[0] in d:d[word[0]]+=1

m = sum(d.values())
max = combinations_count(m,3) if m!=0 else 0
sub = 0
for i in d.values():
  if i>2: sub += combinations_count(i, 3)
  elif i>1: sub += combinations_count(i, 2) * (m-2)

print(max - sub)

### FIXED CODE ###

comp='MARCH'
cnt=[0,0,0,0,0]

n=int(input())
for i in range(n):
  word=input()
  for j in range(len(comp)):
    if word[0]==comp[j]: cnt[j]+=1

ans = 0
for i in range(len(cnt)):
  for j in range(i+1, len(cnt)):
      for k in range(j+1, len(cnt)):
        ans += cnt[i]*cnt[j]*cnt[k]
        
print(ans)
N, K = map(int, input().split())
s = input()
S = [int(x) for x in list(str(s))]

l = []
tmp = 1
p = S[0]

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

i = 0
check = False

if S[0] == 0:
    r = 2 * K - 1
    check = True
else:
    r = 2 * K

ans = sum(l[i:r + 1])
tmp = ans

while r < len(l) - 2:
    tmp += l[r + 1] + l[r + 2]
    r += 2
    if check:
        tmp -= l[i]
        i += 1
        check = False
    else:
        tmp -= l[i] + l[i + 1]
        i += 2
    ans = max(tmp, ans)

if S[-1] == 0:
    tmp += l[r + 1]
    if check:
        tmp -= l[i]
    else:
        tmp -= l[i] + l[i + 1]

ans = max(ans, tmp)
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
s = input()
S = [int(x) for x in list(str(s))]

l = []
tmp = 1
p = S[0]

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

if len(l) == 1:
    print(N)
    exit()

i = 0
check = False

if S[0] == 0:
    r = 2 * K - 1
    check = True
else:
    r = 2 * K

ans = sum(l[i:r + 1])
tmp = ans

while r < len(l) - 2:
    tmp += l[r + 1] + l[r + 2]
    r += 2
    if check:
        tmp -= l[i]
        i += 1
        check = False
    else:
        tmp -= l[i] + l[i + 1]
        i += 2
    ans = max(tmp, ans)

if S[-1] == 0:
    tmp += l[r + 1]
    if check:
        tmp -= l[i]
    else:
        tmp -= l[i] + l[i + 1]

ans = max(ans, tmp)
print(ans)
def main():
    from fractions import gcd

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

    l = 1
    for num in num_list:
        l *= num // gcd(l, num)

    answer = 0
    for num in num_list:
        answer += l // num
        answer %= 1e9 + 7

    print(int(answer))


if __name__ == '__main__':
    main()


### FIXED CODE ###

from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))
for i in range(n):
    x,y = map(int,input().split())
    if x**2 + y**2 <= d**2:
        s += 1
print(s)

### FIXED CODE ###

n,d = map(int,input().split())

s = 0

for i in range(n):
    x,y = map(int,input().split())
    if x**2 + y**2 <= d**2:
        s += 1
print(s)
def func(x):

    if len(x) == 0:
        return True
    elif len(x) < 5:
        return False
    else:
        tmp = False
        if x[:5] == "dream":
            tmp = func(x[5:])

        if x[:7] == "dreamer" and not tmp:
            tmp = func(x[7:])

        if x[:5] == "erase" and not tmp:
            tmp = func(x[5:])

        if x[:6] == "eraser" and not tmp:
            tmp = func(x[6:])

    return tmp

def solve(n):

    t = ""
    ans = func(n, t)
    return "YES" if ans else "NO"

if __name__ == "__main__":
    n = input()
    print(solve(n))


### FIXED CODE ###

def solve(n):

    while len(n) > 4:
        if n[-5:] == "dream":
            n = n[:-5]
        elif n[-7:] == "dreamer":
            n = n[:-7]
        elif n[-5:] == "erase":
            n = n[:-5]
        elif n[-6:] == "eraser":
            n = n[:-6]
        else:
            break

    return "YES" if len(n) == 0 else "NO"

if __name__ == "__main__":
    n = input()
    print(solve(n))
n, map(int, input())
ls = set(map(int, input().split()))
sorted_ls.sort()
f = sorted_ls[int(n/2)]
b = sorted_ls[int(n/2)-1]

for i in range(n):
    if i > n/2:
        print(f)
    else:
        print(b)
    

### FIXED CODE ###

n =  int(input())
ls = list(map(int, input().split()))
sorted_ls = ls.copy()
sorted_ls.sort()
f = sorted_ls[int(n/2)]
b = sorted_ls[int(n/2)-1]

for i in ls:
    if i < f:
        print(f)
    else:
        print(b)
N, Q = [int(x) for x in input().split()]
    S = input()
    lr = [[int(x) for x in input().split()] for _ in range(Q)]
    for l, r in lr:
        cnt = 0
        for i in range(r-l):
            cnt += (S[l-1+i] == 'A' and S[l+i] == 'C')
        print(cnt)


### FIXED CODE ###

N, Q = [int(x) for x in input().split()]
S = input()
lr = [[int(x)-1 for x in input().split()] for _ in range(Q)]
lst = [0] * N
for i in range(N-1):
    lst[i+1] = lst[i] + (S[i] == 'A' and S[i+1] == 'C')
for l, r in lr:
    print(lst[r]-lst[l])
import sys
N = int(input())
D = input().split(' ')
for i in range(N):
    D[i] = int(D[i])
D.sort()
if D[0] != 0 or 0 in D[1:]:
    print(0)
else:
    nums = []
    previous_num = D[0]
    previous_cnt = 1
    cnt = 1
    sum = 1
    for i in range(1,N):
        if D[i] != previous_num:
            if D[i] - previous_num != 1:
                print(0)
                sys.exit()
            previous_num = D[i]
            sum *= previous_cnt ** cnt
            previous_cnt = cnt
            cnt = 1
        else:
            cnt += 1
        if i == N-1:
            sum *= previous_cnt ** cnt
    
    print(sum)


### FIXED CODE ###

N = int(input())
N = N - 1
print(int(N/2))
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if b[0]==0:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1
if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]
if nb>=k:
    ans=min(ans,b[k-1])
exit()


### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if 0 in x:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1

if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]

if nb>=k:
    ans=min(ans,b[k-1])

if nb==0:
    print(-a[-k])
    exit()

if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)
def main():
    # input
    x = int(input())

    dp = [False for _ in range(x+1)]
    for i in range(6):
        dp[100+i] = True

    # calc
    for i in range(106, x+1):
        for j in range(6):
            if dp[i-100-j]:
                dp[i] = True
                break

    if dp[i]:
        print(1)
    else:
        print(0)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    # input
    x = int(input())

    num = x//100
    a = x%100

    if a <= num*5:
        print(1)
    else:
        print(0)


    # calc


if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    if inp % 10 != 0:
        d[i] = inp % 10
        d2[i] = inp
        dct[i] = int(inp/10)*10+10
    else:
        dct[i] = inp

last = sorted(d.items(), key=lambda x: x[1])[0][0]

ll.remove(last)

ans = d2[last]

for i in ll:
    ans += dct[i]

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    if inp % 10 != 0:
        d[i] = inp % 10
        d2[i] = inp
        dct[i] = int(inp/10)*10+10
    else:
        dct[i] = inp

if len(d) == 0:
    ans = 0
else:
    last = sorted(d.items(), key=lambda x: x[1])[0][0]
    ll.remove(last)
    ans = d2[last]

for i in ll:
    ans += dct[i]

print(ans)
import numpy as np

N,M=map(int,input().split())
d=[[] for i in range(N)]
for i in range(M):
    x,y=map(int,input().split())
    d[x-1].append(y-1)
dp=[0 for i in range(N)]

def depth(now,score,d):
    global dp
    if dp[now]==0 or not(dp[now]):
        if d[now]:
            _score=[]
            for i in d[now]:
                _score.append(depth(i,score+1,d)-score)
            dp[now]=max(_score)
        else:
            return score

        return dp[now]+score

    else:
        return dp[now]+score



Max=0
for i in range(N):
    m=depth(i,0,d)
    if  m>Max:            
        Max=m
print(Max)



### FIXED CODE ###

import numpy as np
import sys
sys.setrecursionlimit(100000)
N,M=map(int,input().split())
d=[[] for i in range(N)]
for i in range(M):
    x,y=map(int,input().split())
    d[x-1].append(y-1)
dp=[0 for i in range(N)]

def depth(now,score,d):
    global dp
    if dp[now]==0 or not(dp[now]):
        if d[now]:
            _score=[]
            for i in d[now]:
                _score.append(depth(i,score+1,d)-score)
            dp[now]=max(_score)
        else:
            return score

        return dp[now]+score

    else:
        return dp[now]+score



Max=0
for i in range(N):
    m=depth(i,0,d)
    if  m>Max:            
        Max=m
print(Max)
#Iroha Loves Strings (ABC Edition)
N, L = map(int, input().split())
S = []
for _ in range(N):
    S.append(input())
R = []
K = ""
R.append(S[0])
for i in range(1, N):
    for j in range (0, i):
        if S[i] < R[j]:
            R.insert(j,S[i])
        if S[i] >= R[i-1]:
            R.append(S[i])
for i in range(0,N):
    K = K + R[i]
print(K)

### FIXED CODE ###

A,B,C = map(int,input().split())
S = A+B+C
if S == 17:
    S = S - max(A, B, C)
    if S == 10:
        S = S - min(A, B, C)
        if S == 5:
            print("YES")
        else:
            pass
    else:
        pass
else:
    print("NO")
# -*- coding: utf-8 -*-
from scipy.misc import comb

n, k = map(int, input().split())

mod = int(10 ** 9 + 7)

for i in range(1, k + 1):
    if i > n - k + 1:
        print(0)
    else:
        print(int(comb(k - 1, i - 1)) * int(comb(n - k + 1, i)) % mod)

### FIXED CODE ###

# -*- coding: utf-8 -*-
n, k = map(int, input().split())

mod = int(10 ** 9 + 7)


def comb(n, k):
    res = 1
    for i in range(k):
        res *= n - i
    for i in range(k):
        res //= k - i
    return res

for i in range(1, k + 1):
    if i > n - k + 1:
        print(0)
    else:
        print(comb(k - 1, i - 1) * comb(n - k + 1, i) % mod)
def min_sufficient_load(w, k):
    return check(w, k, 0, sum(w))


def check(w, k, p1, p2):
    trunk_no = 1
    temp = 0
    m = 1+(p1 + p2)>>1
    for i in w:
        if temp + i <= m:
            temp += i
        else:
            trunk_no += 1
            temp = i
    if trunk_no > k:
        return check(w, k, m, p2)
    else:
        if m - p2 == 0:
            return m
        return check(w, k, p1, m)
if __name__=="__main__":
    k,n = map(int,input())
    w = []
    for i in n:
        w.append(i)
    min_sufficient_load(w,k)


### FIXED CODE ###

import math
def min_sufficient_load(w, k):
    return check(w, k, 0, sum(w))

def check(w, k, p1, p2):
    if k==1:
        return p2
    if p2 - p1 == 1:
        if get_trunk_No(w, p1) == k:
            return max(p1,max(w))
        else:
            return max(p2,max(w))
    m = math.ceil((p1+p2)/2)
    trunk_no = get_trunk_No(w,m)
    if trunk_no > k:
        return check(w, k, m, p2)
    else:
        return check(w, k, p1, m)
def get_trunk_No(w,m):
    temp = 0
    trunk_no = 1
    for i in w:
        if temp + i <= m:
            temp += i
            if temp == m:
                trunk_no += 1
                temp = 0
        else:
            trunk_no += 1
            temp = i
    if temp==0:
        trunk_no-=1
    return trunk_no
if __name__=="__main__":
    n,k = map(int,input().split(" "))
    w = []
    for i in range(n):
        w.append(int(input()))
    print(min_sufficient_load(w,k))
import numpy as np
import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = np.sqrt(num)

    for serial in range(3, num, 2):
    
        if serial > sqrt:
            return input_list

        for s in range(serial ** 2, num+1, serial):
            if bool_list[s]:
                input_list[s] = serial
                bool_list[s] = False

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

D = getD(max(A))

flag = True

d_set = set()
for a in A:
    while a > 1:
        d = D[a]
        if d in d_set:
            flag = False
            break
        d_set.add(d)
        while a > 1 & a % d == 0:
            a = a // d

    if not(flag):
        break


if flag:
    print('pairwise coprime')
    exit()

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


### FIXED CODE ###

import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))
pairwise_coprime = True
use_divnum = set()
for i in range(N):
    k = A[i]
    while k != 1:
        if D[k] in use_divnum:
            pairwise_coprime = False
            break
        else:
            use_divnum.add(D[k])
        div = D[k]
        while k % div == 0 and k > 1:
            k = k // div
if pairwise_coprime: 
    print("pairwise coprime")
    exit()
from math import gcd
gcd_of_a = A[0]
for i in range(N):
    gcd_of_a = gcd(gcd_of_a, A[i])
if gcd_of_a == 1:
    print("setwise coprime")
else:
    print("not coprime")
a=int(input())
b=int(input())
c=int(input())
print(((a+b)*h)//2)
  

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
print(((a+b)*c)//2)
a,b = input().split(" ")
if int(b)%int(a)==0:
  print(int(a)+int(b)
else:
  print(int(b)-int(a))

### FIXED CODE ###

a,b = input().split(" ")
print(int(a)+int(b)) if int(b)%int(a)==0 else print(int(b)-int(a))
A,P=map(input().split())
answer = int((A*3+P)/2)
print(answer)

### FIXED CODE ###

A,P =(int(x) for x in input().split())
answer = int((A*3+P)/2)
print(answer)
# -*- coding: utf-8 -*-
while True:
    N = int(input())
    if N >= 1 and N <= 1000:
        continue
    if N < 3:
        print(0)
    else:
        if N/3 > 3.0:
            print(int(N/3)+1)
        else:
            print(int(N/3))

### FIXED CODE ###

while True:
    N = int(input())
    if N >= 1 and N <= 1000:
        break
if N < 3:
    print(0)
if N >= 3:
    print(int(N/3))
n = int(input())

if '7' in str(n):
  print('Yes')
else:
  print('NO')


### FIXED CODE ###

x,y,z=list(map(int,input().split()))

x,y=y,x
x,z=z,x

print(x,y,z)
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import sqrt
from collections import defaultdict
def main():
    n = int(input())
    n2 = int(sqrt(n) + 1)
    d1 = defaultdict(int)

    for i1 in range(1, n2):
        for i2 in range(1, n2):
            for i3 in range(1, n2):
                #p = (i1 + i2) ** 2 - (i1 * i2) + i3 * (i1 + i2 + i3)
                p = i1 ** 2 + i2 ** 2 + i3 ** 2 + i1 * i2 + i2 * i3 + i1 * i3
                d1[p] += 1

    for j1 in range(1, n + 1):
        print(d1[j1])

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    l, r, d = map(int, input().split())
    res = r // d - (l-1) // d
    print(res)

if __name__ == '__main__':
    main()
r, g = map(int, input().split())

print(r + (g-r) * 2)

### FIXED CODE ###

r = int(input())
g = int(input())

print(r + (g-r) * 2)
N  = int(input())
s = [float(i) for i in range(1,N + 1)]
cnt =0.0
for i in s:
    if i % 2 != 0:
        cnt += 1
print(float(cnt/tmp))

### FIXED CODE ###

N  = int(input())
s = [float(i) for i in range(1,N + 1)]
cnt =0.0
for i in s:
    if i % 2 != 0:
        cnt += 1
tmp = float(len(s))
print(float(cnt/tmp))
A, B, C, D, E, F = map(int, input().split())

water = []
for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        n = (i*A + j*B)*100
        if n <= F:
            water.append(n)
water = sorted(list(set(water)))

result = {"0",[0,0]}
noud = []
for i in water:
    suger_limit = E*(i//100)
    for j in range(suger_limit//C + 1):
        for k in range(suger_limit//D + 1):
            n = j*C + k*D
            if n <= suger_limit and i + n <= F and n != 0:
                noudo = 100*n/(i+n)
                noud.append(noudo)
                
                result[str(noudo)] = [i+n,n]


a,b = map(int,result[str(max(noud))])

print(a,b)

### FIXED CODE ###

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

water = []
for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        n = (i*A + j*B)*100
        if n <= F:
            water.append(n)
water = sorted(list(set(water)))

density_d = {}
density = []

for i in water:
    suger_limit = E*(i//100)

    suger = []

    for j in range(suger_limit//C + 1):
        for k in range(suger_limit//D + 1):
            n = j*C + k*D
            if n <= suger_limit and n + i <= F:
                suger.append(n)
    suger = max(suger)
    if i+suger == 0:
        continue
    else:
        density.append(100*suger/(i+suger))
        density_d[100*suger/(i+suger)] = [i + suger, suger]
density = list(set(density))
a, b = map(int, density_d[max(density)])
print(a,b)
s = int(input())

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])

### FIXED CODE ###

s = int(input())

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+2)
        break
    a.append(f(a[i]))
A, B = map(int, input().split())

ans = -1

if A <= 9:
    if B <= 9:
        ans = A * B

print(ans)

### FIXED CODE ###

N = int(input())
ans = 'No'
for i in range(9):
    q, mod = divmod(N, i+1)
    if mod == 0:
        if q <= 9:
            ans = 'Yes'
            break
print(ans)
ans = [1,2,3]
A = input()
B = input()

ans.del(A)
ans.del(B)

print(ans[0])


### FIXED CODE ###

a = input()
b = input()

ans = [1,2,3]

ans.remove(int(a))
ans.remove(int(b))

print(ans[0])
N = input() 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
    if c *= A[i] >= 10**18:
      print(-1)
    else:
      print(c)
  




### FIXED CODE ###

n=int(input())
ls=[int(s) for s in input().split(" ")]

if 0 in ls:
  print(0)
else:
  num=1
  for i in ls:
    num*=i
    if num>10**18:
      num=-1
      break

  print(num)
while True:
    num = list(map(int,input().split()))
    if(num[0] == 0 and num[1] == 0): break
    else:
        flag = False
        for i in range(num[0]):
            str = ""
            if(i == 0 or i == num[0]-1): flag=True
            else: flag=False
            for j in range(num[1]):
                if(j == 0 or j == num[1]-1 or flag=True):
                    str = str + "#"
                else:
                    str = str + "."
            print(str)
        print()
                    


### FIXED CODE ###

while True:
    num = list(map(int,input().split()))
    if(num[0] == 0 and num[1] == 0): break
    else:
        flag = False
        for i in range(num[0]):
            str = ""
            if(i == 0 or i == num[0]-1): flag=True
            else: flag=False
            for j in range(num[1]):
                if(j == 0 or j == num[1]-1 or flag):
                    str = str + "#"
                else:
                    str = str + "."
            print(str)
        print()
# x-500a-100b-5-c = 0 になる方法を探す

a = int(input())
b = int(input())
c = int(input())

x = 500a-100b-50c


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())


count = 0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			#if (str(i) + " " + str(j) + " " + str(k)) == x:
			if 500*(i) + 100*(j) + 50*(k) == x:
				count += 1
				
print(count)
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
p_change = []
m = 0
if n == 0:
  print(x)

for i in p:
    p_change.append(abs(i-x))

for i in range(n):
    if i != 0 and p_change.count(i) != 2:
        m = i
        break
if x-m in p_change:
    print(x+m)
else:
    print(x-m)


### FIXED CODE ###

x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
p_change = []
m = 0
if n == 0:
  print(x)
else:
    for i in p:
        p_change.append(abs(i-x))
 
    if x in p:
        for i in range(n+1):
            if i != 0 and p_change.count(i) != 2:
                m = i
                break
        if x-m in p:
            print(x+m)
        else:
            print(x-m)
    else:
        print(x)
h,a = int(input())
ans = 0
if h % a == 0:
  ans = h // a
else:
  ans = h // a + 1
print(ans)

### FIXED CODE ###

h,a = map(int, input().split())
ans = 0
if h % a == 0:
  ans = h // a
else:
  ans = h // a + 1
print(ans)
N=int(input())
if(N%9==0):
	print('Yes')
else
	print('No')

### FIXED CODE ###

N=int(input())
if(N%9==0):
	print('Yes')
else:
	print('No')
while(True) :
    instr=input()
    if(instr=='?') break;
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='+' :
        print("{}".format(a+b))
    elif op=='-' :
        print("{}".format(a-b))
    elif op=='*' :
        print("{}".format(a*b))
    else :
        print("{}".format(int(a/b)))


### FIXED CODE ###

while(True) :
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='+' :
        print("{}".format(a+b))
    elif op=='-' :
        print("{}".format(a-b))
    elif op=='*' :
        print("{}".format(a*b))
    elif op=='/' :
        print("{}".format(int(a/b)))
    else :
        break