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

    mf = m + f
    if mf <= 80:
        priftf('A')
    elif  65 <=  mf <= 79:
        printf('B')
    elif 50 <= mf <= 64 || r >= 50:
        printf('C')
    elif 30 <= mf <=49:
        printf('D')
    else:
        printf('F')


    

### FIXED CODE ###

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

    mf = m + f
    if m == -1 or f == -1 or mf < 30:
        print('F')
    elif mf < 50 and r < 50:
        print('D')
    elif mf < 65:
        print('C')
    elif mf < 80:
        print('B')
    else:
        print('A')
H=input()
H=int(H)
h=input()
h=int(h)
W=input()
W=int(W)
w=input()
w=int(w)
print((H-h)*(W-w))

### FIXED CODE ###

H,W=map(int,input().split())#標準入力を行う
h,w=map(int,input().split())#標準入力を行う
print((H-h)*(W-w))
n,m=map(int,input().split())
ans=0
if m>n*2:
  m-=n*2
  ans=n+m//4
elif m==n*2:
  ans=n
else:
  ans=m//2
print(ans)

### FIXED CODE ###

from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
for s in range(len(a)-1):
  if s==0:x=a[s]
  x=gcd(x,a[s+1])
print(x)
from collections import defaultdict

H, W, M = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(M)]

dh, dw = defaultdict(int), defaultdict(int)
used = set()

for h, w in l:
    dh[h] += 1
    dw[w] += 1
    used.add((h, w))

ih = sorted(dh.items(), key=lambda x:-x[1])
iw = sorted(dw.items(), key=lambda x:-x[1])

def get(x):
    h, counth = ih[x]
    w, countw = iw[x]
    ans = counth + countw
    if (h, w) in used:
        ans -= 1
    return ans

print(max(get(0), get(1)))


### FIXED CODE ###

from collections import Counter


def solve():
    H, W, M = map(int, input().split())
    dh, dw = Counter(), Counter()
    used = set()

    for _ in range(M):
        h, w = map(int, input().split())
        dh[h] += 1
        dw[w] += 1
        used.add((h, w))

    ih = dh.most_common()
    iw = dw.most_common()

    h, counth = ih[0]
    w, countw = iw[0]

    s = counth + countw
    ans = counth + countw - ((h, w) in used)

    for h, counth in ih:
        for w, countw in iw:
            if counth+countw < s or ans == s:
                break
            b = counth + countw - ((h, w) in used)
            ans = max(ans, b)
    print(ans)


solve()
def get_sum(x1, x2, y1, y2):
    return acc[x2][y2] - acc[x1][y2] - acc[x2][y1] + acc[x1][y1]


h, w, k = map(int, input().split())
s = [[int(c) for c in input()] for i in range(h)]

acc = [[0 for j in range(w + 1)] for i in range(h + 1)]
for i in range(h):
    for j in range(w):
        acc[i + 1][j + 1] = acc[i][j + 1] + acc[i + 1][j] - acc[i][j] + s[i][j]

min_div_cnt = 10 ** 18

for h_div in range(1 << (h - 1)):
    h_ranges = []
    cur_begin = 0
    for i in range(h - 1):
        if (h_div >> i) & 1:
            h_ranges.append([cur_begin, i + 1])
            cur_begin = i + 1
    h_ranges.append([cur_begin, h])
    h_div_cnt = len(h_ranges) - 1

    max_hchoco_cnt = 0
    tgt_h_range = []
    for h_range in h_ranges:
        hchoco_cnt = get_sum(h_range[1], h_range[0], w, 0)
        if hchoco_cnt > max_hchoco_cnt:
            max_hchoco_cnt = hchoco_cnt
            tgt_h_range = h_range

    cur_begin = 0
    v_div_cnt = 0
    is_valid = True
    for i in range(0, w):
        cur_cnt = get_sum(tgt_h_range[1], tgt_h_range[0], i, cur_begin)
        next_cnt = get_sum(tgt_h_range[1], tgt_h_range[0], i + 1, cur_begin)
        if next_cnt - cur_cnt > k:
            is_valid = False
            break
        if cur_cnt <= k and next_cnt > k:
            cur_begin = i
            v_div_cnt += 1

    if is_valid:
        min_div_cnt = min(min_div_cnt, h_div_cnt + v_div_cnt)

print(min_div_cnt)


### FIXED CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


def get_sum(x1, x2, y1, y2):
    return acc[x2][y2] - acc[x1][y2] - acc[x2][y1] + acc[x1][y1]


h, w, k = map(int, input().split())
s = [[int(c) for c in input()] for i in range(h)]

acc = [[0 for j in range(w + 1)] for i in range(h + 1)]
for i in range(h):
    for j in range(w):
        acc[i + 1][j + 1] = acc[i][j + 1] + acc[i + 1][j] - acc[i][j] + s[i][j]

ans = h + w

for h_div in range(1 << (h - 1)):
    h_ranges = []
    h_begin = 0
    for i in range(h - 1):
        if h_div >> i & 1:
            h_ranges.append([h_begin, i + 1])
            h_begin = i + 1
    h_ranges.append([h_begin, h])
    div_cnt = len(h_ranges) - 1

    def is_addable():
        for h_range in h_ranges:
            if get_sum(h_range[1], h_range[0], j + 1, w_begin) > k:
                return False
        return True

    w_begin = 0
    for j in range(w):
        if not is_addable():
            w_begin = j
            div_cnt += 1
            if not is_addable():
                div_cnt = h + w
                break
    ans = min(ans, div_cnt)

print(ans)
condition = (N - 1) * (N - 2) // 2 - K
if condition < 0:
    print(-1)

M = 0
for i in range(2, N+1):
    M += 1
    print(1, i)

for i in range(3, 3 + N - 1 - K):
    M += 1
    print(2, i)

### FIXED CODE ###

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

con= (N - 1) * (N - 2) // 2 - K
if con < 0:
    print(-1)
else:
    M = N - 1 + con
    print(M)
    for i in range(2, N+1):
        print(1, i)
    cnt = 0
    for i in range(2, N):
        for j in range(i + 1, N + 1):
            cnt += 1
            if cnt > con:
                break
            print(i, j)
        if cnt > con:
            break
A,B=[int(x) for in x input().split()]
if A=1:
  A==14
if B=1:
  B==14
if A>B:
  print('Alice')
elif B>A:
  print('Bob')
else:
  print('Drow')

### FIXED CODE ###

A,B=[int(x) for x in input().split()]
if A==1:
  A=14
if B==1:
  B=14
if A>B:
  print('Alice')
elif B>A:
  print('Bob')
else:
  print('Draw')
n=int(input())
s=input()
ans=0
for i in range(1,n):
    ans=max(ans,len(set(s[:i])&set(si[:])))
print(ans)


### FIXED CODE ###

n=int(input())
s=input()
ans=0
for i in range(1,n):
    ans=max(ans,len(set(s[:i])&set(s[i:])))
print(ans)
n,m,q,*abcd=list(map(int, Input.split()))
a=[]
b=[]
c=[]
d=[]

ans = 0

for i in range(q):
    a.append(abcd.pop(0))
    b.append(abcd.pop(0))
    c.append(abcd.pop(0))
    d.append(abcd.pop(0))
    
def dfs(la):
    global ans
    if len(la)==n+1:
        sum_d=0
        #print(la)
        #print(ans)
        for i in range(q):
            if la[b[i]] - la[a[i]] == c[i]:
                sum_d += d[i]
        if sum_d > ans:
            ans = sum_d
        return
    
    la.append(la[-1])
    while(la[-1]<=m):
        dfs(la.copy())
        la[-1] += 1
        

dfs([1])
print(ans)

### FIXED CODE ###

#提出用
n,m,q = list(map(int, input().split()))

a=[]
b=[]
c=[]
d=[]

for i in range(q):
    aa,bb,cc,dd = list(map(int, input().split()))
    a.append(aa)
    b.append(bb)
    c.append(cc)
    d.append(dd)

ans = 0

def dfs(la):
    global ans
    if len(la)==n+1:
        sum_d=0
        #print(la)
        #print(ans)
        for i in range(q):
            if la[b[i]] - la[a[i]] == c[i]:
                sum_d += d[i]
        if sum_d > ans:
            ans = sum_d
        return
    
    la.append(la[-1])
    while(la[-1]<=m):
        dfs(la.copy())
        la[-1] += 1
        

dfs([1])
print(ans)
#お年玉
n,y=map(int,input().split())
a,b,c=0,0,0
for i in range(2001):
    for j in range(2001):
        if i+j<=n and 10000*i+5000*j+1000*(n-i-j)==y:
            a=i
            b=j
            c=n-i-j
            flag=True
            break
if flag:
  print(a,b,c)
if not flag:
    print(-1,-1,-1)

### FIXED CODE ###

#お年玉
n,y=map(int,input().split())
a,b,c=0,0,0
flag=False
for i in range(2001):
    for j in range(2001):
        if i+j<=n and 10000*i+5000*j+1000*(n-i-j)==y:
            a=i
            b=j
            c=n-i-j
            flag=True
            break
if flag:
  print(a,b,c)
if not flag:
    print(-1,-1,-1)
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)¥


A, B, C, D = map(int, input().split())
cnt = B - A + 1
all_range = B // C + B // D - B // lcm(C , D)
sub_end = A - 1
sub_range = sub_end // C + sub_end // D - sub_end // lcm(C , D)
print(cnt - (all_range - sub_range))

### FIXED CODE ###

def solve():
    def gcd(x,y):
        while y != 0:
            x , y = y , x % y
        return x

    A,B,C,D = map(int ,input().split())
    A -= 1
    gcd_val = gcd(C , D)
    lcm_val = C * D // gcd_val
    ReduceFromB = B - (B // C + B // D - B // lcm_val)
    ReduceFromA = A - (A // C + A // D - A // lcm_val)
    print(ReduceFromB - ReduceFromA)

solve()
import math

s = input()

N = len(s)
s = "#" + s
possible = 1
if s[-1] == "1" or s[1] == "0":
  possible = 0
for i in range(1,math.floor(N/2)):
  if s[i] != s[N - i]:
    possible = 0

if not possible:
  print(-1)
elif N == 2:
  if s[1] == "1" and s[2] == "0":
    print(1, 2)
  else:
    print(-1)
elif N == 3:
  if s[1] == "1" and s[2] == "1":
    print(1,2)
    print(2,3)
  else:
    print(-1)
else:
  destination_1sthalf = [1] * (math.floor(N/2) + 2)
  destination_2ndhalf = [1] * (N - math.floor(N/2) -1)
  root = 2
  max_bit = math.floor(N/2)
  for i in range(max_bit, -1, -1):
    if s[i] == "1":
      destination_1sthalf = destination_1sthalf[:root+1] + [root]*(i-1)
      root += 1
  destination = destination_1sthalf + destination_2ndhalf
  for i in range(2,N+1):
    print(i, destination[i])

### FIXED CODE ###

import math

s = input()

N = len(s)
s = "#" + s
possible = 1
if s[-1] == "1" or s[1] == "0":
  possible = 0
for i in range(1,math.floor(N/2)):
  if s[i] != s[N - i]:
    possible = 0

if not possible:
  print(-1)
elif N == 2:
  if s[1] == "1" and s[2] == "0":
    print(1, 2)
  else:
    print(-1)
elif N == 3:
  if s[1] == "1" and s[2] == "1":
    print(1,2)
    print(2,3)
  else:
    print(-1)
else:
  destination = [1] * (N+1)
  dest_change = [0] * (N+1)
  root = 2
  max_bit = math.floor(N/2)
  for i in range(max_bit, -1, -1):
    if s[i] == "1":
      #destination = destination[:root+1] + [root]*(i-1) + destination[root+i:]
      dest_change[root + 1] = dest_change[root + 1] + 1
      dest_change[root + i] = dest_change[root + i] - 1
      root += 1
  for i in range(1,N+1):
    destination[i] = destination[i - 1] + dest_change[i]
  for i in range(2,N+1):
    print(i, destination[i])
import sys,queue,math,copy,itertools,bisect,collections,heapq

def check(x0,y0,p,r):
    for x,y in p:
        if (x-x0)**2 + (y-y0)**2 > r*r:
            return False
    return True


def main():
    eps = 10 ** (-9)
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    dist = lambda x1,y1,x2,y2: math.sqrt((x1-x2)**2 + (y1-y2)**2)
    N = NI()
    p = [LI() for _ in range(N)]

    high = 1000 / 2
    low = 0

    while high > low + 10 ** (-7):
        mid = (high + low) / 2

        for (x1,y1),(x2,y2) in itertools.combinations(p,2):
            r = dist(x1,y1,x2,y2) / 2
            if r > mid + eps:
                low = mid
                break

            x0 = (x1+x2) / 2
            y0 = (y1+y2) / 2
            h = math.sqrt(mid**2 - r**2)
            if y1 == y2:
                xi1 = xi2 = x0
                yi1 = y0 + h / 2
                yi2 = y0 - h / 2
            else:
                d = -(x1-x2) / (y1-y2)
                v = math.sqrt(1+d*d)
                dx = h / 2 / v
                dy = h / 2 / v * d
                xi1 = x0 + dx
                yi1 = y0 + dy
                xi2 = x0 - dx
                yi2 = y0 - dy
            if check(xi1,yi1,p,mid) or check(xi2,yi2,p,mid):
                high = mid
                break
        else:
            low = mid

    print(low)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def check(x0,y0,p,r):
    for x,y in p:
        if (x-x0)**2 + (y-y0)**2 > r*r + 10 ** (-9):
            return False
    return True


def main():
    eps = 10 ** (-10)
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    dist = lambda x1,y1,x2,y2: math.sqrt((x1-x2)**2 + (y1-y2)**2)
    N = NI()
    p = [LI() for _ in range(N)]

    high = 1000
    low = 0

    while high > low + 10 ** (-8):
        mid = (high + low) / 2

        for (x1,y1),(x2,y2) in itertools.combinations(p,2):
            r = dist(x1,y1,x2,y2) / 2
            if r > mid :
                low = mid
                break

            x0 = (x1+x2) / 2
            y0 = (y1+y2) / 2
            h = math.sqrt(mid**2 - r**2)
            if y1 == y2:
                dx = 0
                dy = h
            else:
                d = -(x1-x2) / (y1-y2)
                v = math.sqrt(1+d*d)
                dx = h / v
                dy = h / v * d
            if check(x0+dx,y0+dy,p,mid) or check(x0-dx,y0-dy,p,mid):
                high = mid
                break
        else:
            low = mid

    print(low)


if __name__ == '__main__':
    main()
N=int(imput())
if N<600:
  print(8)
elif N<800:
  print(7)
elif N<1000:
  print(6)
elif N<1200:
  print(5)
elif N<1400:
  print(4)
elif N<1600:
  print(3)
elif N<1800:
  print(2)
else:
  print(1)

### FIXED CODE ###

N=int(input())
if N<600:
  print(8)
elif N<800:
  print(7)
elif N<1000:
  print(6)
elif N<1200:
  print(5)
elif N<1400:
  print(4)
elif N<1600:
  print(3)
elif N<1800:
  print(2)
else:
  print(1)
import itertools
N = input()
P = input()
Q = input()
string1 = tuple(map(int,list(P.split(""))))
string2 = tuple(map(int,list(Q.split(""))))
num =list(itertools.permutations(list(range(1, int(N)+1))))
count = 1
for i in num:
  if i==string1:
    a=count
  if i==string2:
    b=count
  count+=1
print(abs(a-b))

### FIXED CODE ###

import itertools

N = input()
P = input()
Q = input()
string1 = tuple(map(int, list(P.split(" "))))
string2 = tuple(map(int, list(Q.split(" "))))

num =list(itertools.permutations(list(range(1, int(N)+1))))
count = 1

for i in num:
    if i == string1:
        a = count
    if i == string2:
        b = count
    count += 1

print(abs(a-b))
s = input()
k = int(input())

if len(set(s)) == 1 and set(s)[0] == set(['1']):
  print(1)
else:
  for elem in s:
    if int(elem) == 1:
      pass
    else:
      print(elem)
      break

### FIXED CODE ###

s = input()
k = int(input())

for i in range(min(len(s),k)):
    if s[i] != '1':
        print(s[i])
        quit()
 
print('1')
alf=input()
if alf.islower():
  print(a)
else:
  print(A)

### FIXED CODE ###

alf=input()
if alf.islower():
  print("a")
else:
  print("A")
n,m = map(int,input().split())
a = set([int(input())for _ in range(m)])
dp = [0]*(n+1)
dp[0] = 1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

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

### FIXED CODE ###

n,m = map(int,input().split())
a = set([int(input())for i in range(m)])
dp = [0]*(n+1)
dp[0] = 1
if 1 in a :
    dp[1] = 0
else:
    dp[1] = 1
for i in range(2,n+1):
    if i in a:
        continue
    dp[i] = (dp[i-1]+dp[i-2])%1000000007
print(dp[n])
n = int(input())
s = input()
i = 0
while i < n - 1:
  s = s[i]
  if s[i + 1]:
    while s == s[i + 1]:
      s.pop(i + 1)
      n -= 1
  i += 1
print(n)

### FIXED CODE ###

n = int(input())
s = input()

ans = 1
current = s[0]
for i in range(n):
  if current != s[i]:
    ans += 1 
    current = s[i]
print(str(ans))
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines

s = readline().rstrip()
queries = readlines()
tot_1 = 0
for i in queries:
    if i[0] == '1':
        tot_1 += 1
    else:
        if (tot_1 + int(i[2])) % 2 == 0:
            s = s + i[4]
        else:
            s = i[4] + s
if tot_1 % 2 == 1:
    s = s[::-1]
print(s)

### FIXED CODE ###

import sys
from collections import deque

readline = sys.stdin.readline
readlines = sys.stdin.readlines

s = readline().rstrip()
q = readline()
queries = readlines()
s = deque(s)
tot_1 = 0
for i in queries:
    if i[0] == '1':
        tot_1 += 1
        continue
    c = i[4]
    if (tot_1 + int(i[2])) % 2 == 0:
        s.append(c)
    else:
        s.appendleft(c)
ans = "".join(s) if tot_1 % 2 == 0 else "".join(reversed(s))
print(ans)
import numpy as np

N = int(input())
A = np.fromstring(input(), np.uint64, sep=" ")

uniq, counts = np.unique(A, return_counts=True)

p = lambda n: n * (n - 1) // 2

n = p(counts)
m = p(counts-1)

ans = n.sum() - n + m

mapping = dict(zip(uniq, ans))

for a in A:
    print(mapping[a])


### FIXED CODE ###

from collections import defaultdict
import numpy as np

N = int(input())
A = np.fromstring(input(), np.int, sep=" ")

uniq_count = defaultdict(int)
for a in A:
    uniq_count[a] += 1
uniq = np.fromiter((uniq_count.keys()), np.int)
counts = np.fromiter(uniq_count.values(), np.int)

p = lambda n: n * (n - 1) // 2

n = p(counts)
m = p(counts - 1)

ans = n.sum() - n + m

mapping = dict(zip(uniq, ans))

for a in A:
    print(mapping[a])
a = input()
return a*a*a

### FIXED CODE ###

x = input()
print x*x*x
N,K=map(int,input().split())
A=sorted(list(map(int,input().split())),reverse=True)
MOD=10**9+7
if N==K:
    ans=1
    for i in A:
        ans=ans*i%MOD
    print(ans)
    exit()
if K==1:
    print(A[0]%MOD)
    exit()
if K%2==1 and A[0]==0:
    print(0)
    exit()
if K%2==1 and A[0]<0:
    ans=1
    for i in range(K):
        ans=ans*A[i]%MOD
    print(ans)
    exit()
if N-A.count(0) <K:
    print(0)
    exit()
if A[-1]>=0:
    ans=1
    for i in range(K):
        ans=ans*A[i]%MOD
    print(ans)
    exit()
l=0
r=N-1
t=[]
c=0
if K%2==1:
    tk=K-1
    flg=True
else:
    tk=K
    flg=False
while c<tk:
    if A[l]*A[l+1]<=A[r]*A[r-1]:
        t.append(A[r])
        t.append(A[r-1])
        r+=2
        c+=2
    else:
        t.append(A[l])
        t.append(A[l+1])
        l+=2
        c+=2
if flg:
    t.append(A[l])
ans=1
for i in t:
    ans=ans*i%MOD
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
A=sorted(list(map(int,input().split())),reverse=True)
MOD=10**9+7
if N==K:
    ans=1
    for i in A:
        ans=ans*i%MOD
    print(ans)
    exit()
if K==1:
    print(A[0]%MOD)
    exit()
if K%2==1 and A[0]==0:
    print(0)
    exit()
if K%2==1 and A[0]<0:
    ans=1
    for i in range(K):
        ans=ans*A[i]%MOD
    print(ans)
    exit()
if N-A.count(0) <K:
    print(0)
    exit()
if A[-1]>=0:
    ans=1
    for i in range(K):
        ans=ans*A[i]%MOD
    print(ans)
    exit()
l=0
r=N-1
t=[]
c=0
if K%2==1:
    tk=K-1
    flg=True
else:
    tk=K
    flg=False
while c<tk:
    if A[l]*A[l+1]<=A[r]*A[r-1]:
        t.append(A[r])
        t.append(A[r-1])
        r-=2
        c+=2
    else:
        t.append(A[l])
        t.append(A[l+1])
        l+=2
        c+=2
if flg:
    t.append(A[l])
ans=1
for i in t:
    ans=ans*i%MOD
print(ans)
n=int(input())
ls=[0]*n
xyz=[1,1,1]
p=6
cnt=0
while p<=n:
  if x==y and x==z:
    ls[p-1]=1
  else:
    ls[p-1]=3
  xyz[cnt%3]+=1
  p=xyz[0]**2+xyz[1]**2+xyz[2]**2+xyz[0]*xyz[1]+xyz[1]*xyz[2]+xyz[0]*xyz[2]
for i in ls:
  print(i)

### FIXED CODE ###

n=int(input())
ls=[0]*n
x=1
y=1
z=1
p=6
m=int(n**0.5)
for x in range(1,m+3):
  for y in range(1,x+1):
    for z in range(1,y+1):
      k=6
      if x==y or y==z:
        k=3
        if x==z:
          k=1
      j=x*x+y*y+z*z+x*y+y*z+x*z
      if j<=n:
        ls[j-1]+=k
      else:
        break
for i in ls:
  print(i)
A, B, C = map(int, input().split())
print(A+C if str(B)=="+" else A-C)

### FIXED CODE ###

A, B, C = map(str, input().split())
print(int(A)+int(C) if B=="+" else int(A)-int(C))
s = 0
N = int(input())
for i in range(1, int(N/2)):
    if N%i == 0 and i > s:
        s = i
print(s+(N//s)-2)

### FIXED CODE ###

import sys
input = sys.stdin.readline
s = 0
N = int(input())
for i in range(1, int(N**(1/2))+1):
    if N%i == 0 and i > s:
        s = i
print(s+(N//s)-2)
def main():
    num = int(stdin.readline())
 
    for _ in xrange(num):
        x = stdin.readline().rstrip()
        y = stdin.readline().rstrip()
 
        n = len(y) + 1
 
        cim1 = [0] * n
        for i, xi in enumerate(x, start=1):
            ci = [0] * n
            for j, yj in enumerate(y, start=1):
                if xi == yj:
                    ci[j] = cim1[j-1] + 1
                elif cim1[j] >= ci[j-1]:
                    ci[j] = cim1[j]
                else:
                    ci[j] = ci[j-1]
            cim1 = ci
 
       print(ci[j])
 
 
main()

### FIXED CODE ###

def solve():
    a1 = raw_input()
    a2 = raw_input()
    a = len(a1)
    b = len(a2)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = a1[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == a2[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
 
n = input()
for i2 in range(n):
    print solve()
N = input()

match_flg = 0
for nn in N:
  if( n== "7" ):
    print( Yes )
    match_flg = 1
    break
if( match_flg == 0 ):
	print("No")

  

### FIXED CODE ###

N = input()
match_flg = 0
for nn in N:
  if( nn== "7" ):
    print( "Yes" )
    match_flg = 1
    break
if( match_flg == 0 ):
	print("No")
import math


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


def resolve():
    N, K = map(int, input().split())
    const = 1e9 + 7
    n_iter = int(min(K, N - K + 1))
    for i in range(n_iter):
        ans = combinations_count(N - K + 1, i + 1) * combinations_count(
            K - 1, i)
        print(int(ans % const))


resolve()

### FIXED CODE ###

import math


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


def resolve():
    N, K = map(int, input().split())
    const = 1e9 + 7
    for i in range(1, K + 1):
        if (N - K + 1 >= i):
            print(
                combinations_count(N - K + 1, i) *
                combinations_count(K - 1, i - 1) % 1000000007)
        else:
            print(0)
            
resolve()
a=input();b=input();h=input()

print((a+b)*h//2)

### FIXED CODE ###

a=int(input());b=int(input());h=int(input())

print((a+b)*h//2)
a = input()
x=int(a)
h=int(x/3600)
m=int((x-h*3600)/60)
s=x-h*3600-m*60
print(h+":"+m+":"+s)

### FIXED CODE ###

a = input()
x=int(a)
h=int(x/3600)
m=int((x-h*3600)/60)
s=x-h*3600-m*60
print(str(h)+":"+str(m)+":"+str(s))
def coffee(n, ar):
    status = []
    if ar[3] == ar[4] and ar[5] == ar[6]:
      return 'Yes'
    else:
      return 'No'

if __name__ == '__main__':

    n = int(input())

    ar = list(map(str, input().rstrip().split()))

    result = coffee(n, ar)
    print(result)

### FIXED CODE ###

def coffee(word):
    ar = [char for char in word] 
    if (ar[2] == ar[3]) and (ar[4] == ar[5]):
      return 'Yes'
    else:
      return 'No'

if __name__ == '__main__':

    ar = str(input())

    result = coffee(ar)
    print(result)
(n,m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])
 
for i in range(m):
    b.append(int(input()))
 
print(A)
print(b)

for i in range(n):
    s = 0
    for j in range(m):
        m += A[i][j] * b[j]
    print(s)

### FIXED CODE ###

(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])
 
for i in range(m):
    b.append(int(input()))
 
for i in range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)
from lib2to3.fixer_util import String
s, t = map(String, input().split())
print(s + t)

### FIXED CODE ###

s, t = input().split()
print(t+s)