Harryxun/stf_run huggingface dataset:
from math import factorial
inf = input().split()
N = int(inf[0])
K = int(inf[1])
M = N-K
for i in range(1,K+1):
  red = factorial(M+1)//(factorial(i)*factorial(M+1-i))
  blue = factorial(K-1)//(factorial(i-1)*factorial(K-i))
  print(red*blue%(10**9+7))


### FIXED CODE ###

from operator import mul
from functools import reduce
 
def cmb(n,r):
    r = min(n-r,r)
    if r==0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

inf = input().split()
N = int(inf[0])
K = int(inf[1])
M = N-K
for i in range(1,K+1):
  if M+1<i:
    red = 0
  else:
    red = cmb(M+1,i)
  blue = cmb(K-1,i-1)
  print(red*blue%(10**9+7))
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
if isinstance((a + b) / 2):
    print((a + b) / 2)
else:
    print("IMPOSSIBLE")


### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b = map(int, input().split())
if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")
n = list(int(input()))
for i in range(3):
  print(max(n))

### FIXED CODE ###

n = list(input())
ls = []
for i in range(3):
  ls.append(int(n[i]))
  
if ls[0] >= ls[1] and ls[0] >= ls[2]:
  for i in range(3):
    print(ls[0],end="")
else:
  for i in range(3):
    print(ls[0]+1,end="")
import math
import numpy as np
n=input()
list=list(map(int,input().split()))
list=np.array(list,'int64')
ans=np.prod(list)
p=math.log10(ans)
if p>=18:
  print(-1)
else:
  print(np.prod(list))

### FIXED CODE ###

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

flg=True
if 0 in list:
  print(0)
  flg=False
else:
  prod=1
  for a in list:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      flg=False
      break
if flg:
  print(prod)
n=int(input())
a = list(map(int,input().split()))
if 0 in a:
    print(0)

prod = 1
for a in A:
    prod *= a
    if prod > 10**18:
        print(-1)

print(prod)


### FIXED CODE ###


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

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)
    return

main ()
import sys
import math
from collections import defaultdict
x,y,a,b,c=map(int,sys.stdin.readline().split())
red=list(map(int,sys.stdin.readline().split()))
green=list(map(int,sys.stdin.readline().split()))
color=list(map(int,sys.stdin.readline().split()))
red.sort()
green.sort()
color.sort()
s=0
for i in range(a-x,a):
    s+=red[i]
for i in range(b-y,b):
    s+=green[i]
i,j,k=c-1,a-x,b-y
#print(red,'red')
#print(green,'green')
#print(color,'color')
#print(s,'s',x,'x',y,'y',i,'i',j,'j',k,'k')
while i>=0 and j<a and k<b:
    if color[i]>red[j] and color[i]>green[k]:
        if green[k]>red[j]:
            s-=red[j]
            s+=color[i]
            j+=1
            i-=1
            continue
        else:
            s-=green[k]
            s+=color[i]
            k+=1
            i-=1
            continue
    if color[i]>red[j]:
        s-=red[j]
        s+=color[i]
        i-=1
        j+=1
        continue
    if color[i]>green[k]:
        s-=green[k]
        s+=color[i]
        i-=1
        k+=1
        continue
    i-=1
if i==0:
    print(s)
else:
    while i>=0 and j<a:
        if color[i]>red[j]:
            s-=red[j]
            s+=color[i]
            i-=1
            j+=1
            continue
        i+=1
    while i>=0 and k<b:
        if color[i]>green[k]:
            s-=green[k]
            s+=color[i]
            i-=1
            k+=1
            continue
        i-=1
    print(s)
    
    


### FIXED CODE ###

import sys
import math
from collections import defaultdict
x,y,a,b,c=map(int,sys.stdin.readline().split())
red=list(map(int,sys.stdin.readline().split()))
green=list(map(int,sys.stdin.readline().split()))
color=list(map(int,sys.stdin.readline().split()))
red.sort()
green.sort()
color.sort()
s=0
for i in range(a-x,a):
    s+=red[i]
for i in range(b-y,b):
    s+=green[i]
i,j,k=c-1,a-x,b-y
#print(red,'red')
#print(green,'green')
#print(color,'color')
#print(s,'s',x,'x',y,'y',i,'i',j,'j',k,'k')
while i>=0 and j<a and k<b:
    if color[i]>red[j] and color[i]>green[k]:
        if green[k]>red[j]:
            s-=red[j]
            s+=color[i]
            j+=1
            i-=1
            continue
        else:
            s-=green[k]
            s+=color[i]
            k+=1
            i-=1
            continue
    if color[i]>red[j]:
        s-=red[j]
        s+=color[i]
        i-=1
        j+=1
        continue
    if color[i]>green[k]:
        s-=green[k]
        s+=color[i]
        i-=1
        k+=1
        continue
    i-=1
if i==0:
    print(s)
else:
    while i>=0 and j<a:
        if color[i]>red[j]:
            s-=red[j]
            s+=color[i]
            i-=1
            j+=1
            continue
        i-=1
    while i>=0 and k<b:
        if color[i]>green[k]:
            s-=green[k]
            s+=color[i]
            i-=1
            k+=1
            continue
        i-=1
    print(s)
n,m = map(int,input().split())
a = [int(x) for x in input().split()]
for i in range(m):
  b,c = map(int,input().split())
  cnt = 0
  a = sorted(a)
  for j in range(n):
    print(a)
    if a[j] < c:
      a[j] = c
      cnt += 1
    if cnt == b:
      break
print(sum(a))

### FIXED CODE ###

# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop, heapify
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


def main():
    n, m = LI()
    a = sorted(list(LI()))
    # 1. c以下をcに毎回置き換え.
    # for i in range(m):
    #     b, c = LI()
    #     for j in range(b):
    #         if a[j] > c:
    #             break
    #         heappushpop(a, c)
    # print(sum(a))

    # 2. 大きいcから入れていってbの累計がlen(a)になったら即終わり.
    # bc = LIR(m)
    # bc.sort(key=lambda x: x[1])
    # cnt = 0
    # for pair in bc:
    #     heappushpop(a, pair[1])
    #     cnt += pair[0]
    #     if cnt > len(a):
    #         break
    # print(sum(a))

    bc = LIR(m)
    bc.sort(key=lambda x: x[1], reverse=True)
    d = []
    i = 0
    while len(d) < n and i < len(bc):
        if bc[i][0] + len(d) < n:
            d.extend([bc[i][1]] * bc[i][0])
        else:
            d.extend([bc[i][1]] * (n - len(d)))
            break
        i += 1
    for i in range(len(d)):
        if d[i] < a[i]:
            break
        a[i] = d[i]
    print(sum(a))


if __name__ == "__main__":
    main()
s = input()
k = int(input())
ans = ''
if s[1] == '1':
  ans = 1
else:
  ans = s[1]
print(ans)

### FIXED CODE ###

import sys

input = sys.stdin.readline

def main():
    ans = ''
    index = 0
    s = input().rstrip('\n')
    k = int(input())
    for i in range(len(s)):
        if s[i] != '1':
            ans = s[i]
            index = i
            break
    if ans == '' or k < index+1:
        ans = '1'
    print(ans)

if __name__ == '__main__':
    main()
f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)

while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in t:
    print(y)
  if lent(it) == 0:
    print('NA')
  print (' ')

### FIXED CODE ###

f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)
 
a = False
while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  if a:
    print ('')
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in it:
    print(y)
  if len(it) == 0:
    print('NA')
  a = True
s = [i for i in input()]

str = []
ans = []

for i in s:
    if i in "ACGT":
        str.append(i)
    else:
        ans.append(len(str))
        str = []
print(max(ans))

### FIXED CODE ###

S = input()

ACGT = 'ACGT'

count = []
tmp_num = 0
for i in S:
    if i in ACGT:
        tmp_num += 1
    elif i not in ACGT:
        count.append(tmp_num)
        tmp_num = 0
count.append(tmp_num)

print(max(count))
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

for cx in range(101):
    for cy in range(101):
        for i,r in enumerate(xyh):
            if r[2] > 1:
                ch = r[2] + abs(r[0] - cx) + abs(r[1] - cy)
        j = False
        for i,r in enumerate(xyh):
            if r[2] != ch - abs(r[0] - cx) - abs(r[1] - cy):
                j = True
                break
        if not j:
            print(cx,cy,ch)


### FIXED CODE ###

n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

for cx in range(101):
    for cy in range(101):
        for r in xyh:
            if r[2] > 0:
                ch = r[2] + abs(r[0] - cx) + abs(r[1] - cy)
                break
        j = False
        for r in xyh:
            if r[2] != max((ch - abs(r[0] - cx) - abs(r[1] - cy)),0):
                j = True
                break
        if not j:
            print(cx,cy,ch)
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
f=[b-a,c-b,d-c,e-d]
 
if(f[0]>k or f[1]>k or f[2]>kor f[3]>k):
  print(':(')
elif((f[0]+f[1])>k or (f[1]+f[2])>k or (f[2]+f[3])>k):
  print(':(')
elif((f[0]+f[1]+f[2])>k or(f[1]+f[2]+f[3])>k):
  print(':(')
elif(e-a)>k:
  print(':(')
else:
  print('Yay!')

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
f=[b-a,c-b,d-c,e-d]
 
if((f[0]>k) or (f[1]>k) or (f[2]>k)or (f[3]>k)):
  print(':(')
elif(((f[0]+f[1])>k)or ((f[1]+f[2])>k)or ((f[2]+f[3])>k)):
  print(':(')
elif(((f[0]+f[1]+f[2])>k) or((f[1]+f[2]+f[3])>k)):
  print(':(')
elif((e-a)>k):
  print(':(')
else:
  print('Yay!')
A,B=map(int,input().split())
x=[1,2,3]
print(x(x!=A and x!=B))

### FIXED CODE ###

A = int(input())
B = int(input())
print(6-A-B)
N, M = map(int, input().split())
ls = [[int(x) for x in input().split()] for _ in range(N)]

q = [[] for _ in range(M)]
for a, b in ls:
    if a <= M:
        q[M-a].append(b*-1)

# print(q)

from heapq import heappop

pool = []
answer = 0
for x in reversed(q):
    pool.extend(sorted(x))
    m = heappop(pool)*-1
    answer += m
    

print(answer)

### FIXED CODE ###

N, M = map(int, input().split())
ls = [[int(x) for x in input().split()] for _ in range(N)]


q = [[0] for _ in range(M)]
for a, b in ls:
    if a <= M:
        q[M-a].append(b*-1)

# print(q)

from heapq import heappop, heappush

pool = []
answer = 0
for x in reversed(q):
    for y in x:
        heappush(pool, y)
    m = heappop(pool)*-1
    answer += m
    

print(answer)
import math

s = input().split()

A = int(s[0])
B = int(float(s[1])*100)

result = A*B
result = int(str(result)[:-2])
print(result)

### FIXED CODE ###

s = input().split()

A = int(s[0])
B = int(s[1].replace(".", ""))
m = A*B

if m>=100:
  result = int(str(m)[:-2])
else:
  result = 0
  
print(result)
N = input()
n = [int(c) for c in s]
for ni in n:
  if ni == 7:
    print("Yes")
    exit()
print("No")
    

### FIXED CODE ###

N = input()
n = [int(c) for c in N]
for ni in n:
  if ni == 7:
    print("Yes")
    exit()
print("No")
S = input()

count = 1
answer = [0] * len(S)
# RLの切り替わるインデックスをマーク
n = 0
for i in range(len(S) - 1):
    if (S[i] == S[i + 1]):
        count += 1
    else:
        if (S[i + 1] == 'R'):
            # Lを割り振る
            answer[n] += count // 2
            answer[n + 1] += -(-count // 2)
            count = 1
        else:
            # Rを割り振る
            answer[i] += -(-count // 2)
            answer[i + 1] += count // 2
            count = 1
            n = i
    # 右端のLを割り振る
    if (i == len(S) - 2):
        answer[n] += count // 2
        answer[n + 1] += -(-count // 2)

for i, c in enumerate(answer):
    if (i == 0):
        print(c, end='')
    else:
        print(f" {c}", end='')


### FIXED CODE ###

S = input()

count = 1
answer = [0] * len(S)
# RLの切り替わるインデックスをマーク
n = 0
for i in range(len(S) - 1):
    if (S[i] == S[i + 1]):
        count += 1
    else:
        if (S[i + 1] == 'R'):
            # Lを割り振る
            answer[n] += count // 2
            answer[n + 1] += -(-count // 2)
            count = 1
        else:
            # Rを割り振る
            answer[i] += -(-count // 2)
            answer[i + 1] += count // 2
            count = 1
            n = i
    # 右端のLを割り振る
    if (i == len(S) - 2):
        answer[n] += count // 2
        answer[n + 1] += -(-count // 2)

for i, c in enumerate(answer):
    print(c, end='')
    print(' ', end='')
# Circle

# Import math.py
from math import pi

radius = int(input())
r = radius

area = r * r * pi
circumference = 2 * r * pi
print(area, circumference)



### FIXED CODE ###

# Circle

# Import math.py
from math import pi

radius = float(input())
r = radius

area = r * r * pi
circumference = 2 * r * pi
print(area, end = " ")
print(circumference)
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(k,n+1):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

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

for i in range(k,n):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')
A,B,C=map(input().split())
can=(A-B)
if (C-can)>0:
    print(C-can)
else:
    print(0)


### FIXED CODE ###

A,B,C=map(int,input().split())
can=(A-B)
if (C-can)>0:
    print(C-can)
else:
    print(0)
print(int(eval(input()) * eval(input()))

### FIXED CODE ###

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


### FIXED CODE ###

a = int(input())
print(a+(a*a)+(a*a*a))
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  a = int(read())
  s = input()
  if a<3200:
    print('red')
  else:
    print(s)
  
  
if __name__ == '__main__':
  main()

### FIXED CODE ###

from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  a = int(readline())
  s = input()
  if a<3200:
    print('red')
  else:
    print(s)
  
  
if __name__ == '__main__':
  main()
X, N = map(int, input().split())
p = list(map(int, input().split()))

max_num = max(p)
lst = []
for i in range(max_num+2):
  if i not in p:
    lst.append(i)
tmp = float("inf")
for j in lst:
  if tmp > abs(X-j):
    tmp = abs(X-j)
    ans = j
print(ans)

### FIXED CODE ###

X, N = map(int, input().split())
if N == 0:
  print(X)
  exit()
p = list(map(int, input().split()))

max_num = max(p)
lst = []
for i in range(max_num+2):
  if i not in p:
    lst.append(i)
tmp = float("inf")
for j in lst:
  if tmp > abs(X-j):
    tmp = abs(X-j)
    ans = j
print(ans)
N = int(input())
w = list(map(int, input().split(' ')))


border = N // 2
w1 = sum(w[:border])
w2 = sum(w[border:])

sub = w1 - w2
direction = None
if sub > 0:
  # w1が大きい
  direction = -1
elif sub < 0:
  # w2が大きい
  direction = 1
else:
  # 両者等しい
  print('0')
  return

prev_sub = 0
while(True):
  prev_sub = sub
  w1 += direction * w[border]
  w2 += -direction * w[border]
  border += direction

  sub = w1 - w2
  if abs(sub) >= abs(prev_sub):
    print(abs(prev_sub))
    exit()

### FIXED CODE ###

N = int(input())
w = list(map(int, input().split(' ')))


border = N // 2
w1 = sum(w[:border])
w2 = sum(w[border:])

sub = w1 - w2
direction = None
if sub > 0:
  # w1が大きい
  direction = -1
  border -= 1
elif sub < 0:
  # w2が大きい
  direction = 1
else:
  # 両者等しい
  print('0')
  exit()

prev_sub = 0
while(True):
  prev_sub = sub
  w1 += direction * w[border]
  w2 += -direction * w[border]
  border += direction

  sub = w1 - w2
  if abs(sub) >= abs(prev_sub):
    print(abs(prev_sub))
    exit()
import sys
from functools import lru_cache
sys.setrecursionlimit(10**7)
MOD=10**9+7
N, M = map(int, input().split())

@lru_cache(maxsize=None)
def fct(n, mod=MOD):
    return (n * fct(n-1)) % MOD if n != 0 else 1

# @lru_cache(maxsize=None)
def pmu(n, r, mod=MOD):
    return (fct(n) * pow(fct(n-r), mod-2, mod)) % mod

# @lru_cache(maxsize=None)
def cmb(n, r, mod=MOD):
    return (pmu(n, r) * pow(fct(r), mod-2, mod)) % mod

def solve():
    # {the num of case B when A=range(1,N+1)} x {permutation of A}
    # use inclusion-exclusion principle against former
    ans = 0
    for i in range(N+1):
        cp = cmb(N, i) * pmu(M-i, N-i)
        ans = (ans + (1 if i%2==0 else -1) * cp) % MOD
    return (ans * pmu(M, N)) % MOD

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


### FIXED CODE ###

MOD=10**9+7
N, M = map(int, input().split())

FCT = [1]
for i in range(1, M+1):
    FCT.append((FCT[-1] * i)%MOD)

def pmu(n, r, mod=MOD):
    return (FCT[n] * pow(FCT[n-r], mod-2, mod)) % mod

def cmb(n, r, mod=MOD):
    return (pmu(n, r) * pow(FCT[r], mod-2, mod)) % mod

def solve():
    # {the num of case B when A=range(1,N+1)} x {permutation of A}
    # use inclusion-exclusion principle against former
    ans = 0
    for i in range(N+1):
        cp = (cmb(N, i) * pmu(M-i, N-i))%MOD
        ans = (ans + (1 if i%2==0 else -1) * cp) % MOD
    return (ans * pmu(M, N)) % MOD

if __name__ == "__main__":
    print(solve())
A,B=list(map(int,input().split(" ")))
A={1,3,5,7,8,10,12}
B={4,6,9,11}
print("Yes" if {x,y} <= A or {x,y} <= B else "No")

### FIXED CODE ###

x,y = map(int, input().split())
A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
print("Yes" if {x, y} <= A or {x, y} <= B else "No")
n = int(input())
li = list(map(int,input().split()))	
ans_li =[]
ans_1 = 0
for i in range(n-1):
  if i == n-2:
    ans_li.append(ans_1)
    break
  elif li[i] >= li[i+1]:
     ans_1 += 1
  else:
    ans_li.append(ans_1)
print(max(ans_li))

### FIXED CODE ###

n = int(input())
li = list(map(int,input().split()))	
if n == 1:
  print("0")
else:
  ans_li =[]
  ans_1 = 0
  for i in range(n-1):
    if li[i] >= li[i+1]:
       ans_1 = ans_1 + 1
    elif li[i]<li[i+1]:
      ans_li.append(ans_1)
      ans_1 = 0
    if i == n-2:
      ans_li.append(ans_1)
  print(max(ans_li))
S = input()
N = len(S)
ans = "inf"
for i in range(N-2):
  tmp = abs(753 - int(S[i:i+2])
  ans = min(ans,tmp)
print(ans)

### FIXED CODE ###

S = input()
N = len(S)
ans = 1000
for i in range(N-2):
	tmp = abs(753 -(int(S[i:i+3])))
	ans = min(ans,tmp)
print(ans)
K=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a=int(input())
print K[a-1]

### FIXED CODE ###

K=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a=int(input())
print(K[a-1])
n = input()
a, b = n.split()
x = a * b
y = 2 * (a + b)
print(x, y)


### FIXED CODE ###

n = input()
a, b = n.split()
a = int(a)
b = int(b)
x = a * b
y = 2 * (a + b)
print(x, y)
N, K = map(int, input().split())
 
calc = 0
for i in range(1, N+1):
  tmp = i
  cnt = 0
  while tmp <= K-1
    tmp*=2
    cnt+=1
  calc += (1/N) * (1/(2*cnt))

print(calc)

### FIXED CODE ###

N, K = map(int, input().split())
 
calc = 0
for i in range(1, N+1):
  tmp = i
  cnt = 0
  while tmp <= K - 1:
    tmp*=2
    cnt+=1
  calc += (1/N) * (1/(2**cnt))

print(calc)
X = int(input())
a = X//100

Xlist = str(X)

import sys

if X <100:
    print(0)
    sys.exit
    
if a*5+1 <= int(Xlist[-2] + Xlist[-1]) and int(Xlist[-2] + Xlist[-1]) <=99:
    print(0)
else:
    print(1)

### FIXED CODE ###

X = int(input())

a = X//100

Xlist = str(X)

import sys

if X <100:
    print(0)
    sys.exit()
    
if a*5+1 <= int(Xlist[-2] + Xlist[-1]) and int(Xlist[-2] + Xlist[-1]) <=99:
    print(0)
else:
    print(1)
t = input()

list_t = list(t)

for i in range(len(list_t)):
    if list_t[i] == '?':
        if i > 0:
            if list_t[i - 1] == 'P':
                list_t[i] = 'D'
            else:
                list_t[i] = 'D'
        if i < len(list_t) + 1:
            if list_t[i + 1] == 'D':
                list_t[i] = 'P'

print(''.join(list_t))

### FIXED CODE ###

t = input()

list_t = list(t)

n = len(list_t)

for i in range(n):
    if n == 1:
        list_t[i] = 'D'
        break
    if list_t[i] == '?':
        if i > 0 and i < n - 1:
            if list_t[i - 1] == 'P' and list_t[i + 1] == 'P':
                list_t[i] = 'D'
            if list_t[i - 1] == 'P' and list_t[i + 1] == 'D':
                list_t[i] = 'D'
            if list_t[i - 1] == 'P' and list_t[i + 1] == '?':
                list_t[i] = 'D'
            if list_t[i - 1] == 'D' and list_t[i + 1] == 'P':
                list_t[i] = 'D'
            if list_t[i - 1] == 'D' and list_t[i + 1] == 'D':
                list_t[i] = 'P'
            if list_t[i - 1] == 'D' and list_t[i + 1] == '?':
                list_t[i] = 'P'
        elif i > 0:
            if list_t[i - 1] == 'P':
                list_t[i] = 'D'
            if list_t[i - 1] == 'D':
                list_t[i] = 'D'
        elif i < n - 1:
            if list_t[i + 1] == 'P':
                list_t[i] = 'D'
            if list_t[i + 1] == 'D':
                list_t[i] = 'P'
            if list_t[i + 1] == '?':
                list_t[i] = 'D'


print(''.join(list_t))
S = input()
Q = int(input())
que2 = []
que2.append(S)

for _ in range(Q):
    que = list(map(str, input().split()))
    if que[0] == "1":
        que2.reverse()
    elif que[1] == "1":
        que2.insert(0,que[2])
    elif que[1] == "2":
        que2.apend(que[2])
print(que2)

### FIXED CODE ###

from collections import deque

S = input()
Q = int(input())
q = deque(S)
fg = False
for i in range(Q):
    que = list(map(str , input().split()))
    if que[0] == "1":
        fg = not fg
    elif (que[1] == "1" and fg == False) or (que[1] == "2" and fg == True) :
        q.appendleft(que[2])
    else:
        q.append(que[2])
if fg:
    q.reverse()
print("".join(q))
a, b, x = [int(i) for i in input().split()]
for i in range(1,10):
  n = (x-b*i)/float(a)
  if n<0:
    if i==9:
      print(0)
    continue
  if len(str(int(n)))==i:
    print(int(n)-1)
    break
  elif i==9:
    print(10**9)

### FIXED CODE ###

s = str(input())
lst = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

print(7-int(lst.index(s)))