Harryxun/stf_run huggingface dataset:
from math import factorial
from decimal import *

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

for i in range(1, k+1):
    ans = ((factorial(n-k+1) // factorial(i) // factorial(n-k+1-i)) * \
        (factorial(k-1) // factorial(i-1) // factorial(k-i))) \
        % (10**9 + 7)
    print(ans)

### FIXED CODE ###

from math import factorial
from decimal import *

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

for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
    else:
        ans = ((factorial(n-k+1) // factorial(i) // factorial(n-k-i+1)) * \
            (factorial(k-1) // factorial(i-1) // factorial(k-i))) \
            % (10**9 + 7)
        print(ans)
#     if i == 0:
#         print(n-k+1)
#     elif i == (k-1):
A,B,C,D=map(int,input().split())
Tattack=ceil(A/D)
Aattack=ceil(C/B)
if Tattack>=Aattack:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import math
A,B,C,D=map(int,input().split())
Tattack=math.ceil(A/D)
Aattack=math.ceil(C/B)
if Tattack>=Aattack:
  print("Yes")
else:
  print("No")
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])
    
def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]

n,m = map(int, input().split())
a=[]
b=[]
for i in range(m):
    aa,bb=map(int,input().split())
    a.append(aa)
    b.append(bb)

graph=np.zeros((n,n))

for i in range(m):
    graph[a[i]-1][b[i]-1] = 1
    graph[b[i]-1][a[i]-1] = 1

d,p=shortest_path(graph,return_predecessors=True)

for i in range(1,n):
    for j in range(i,n):
        if graph[i][j] == np.inf:
            print('No')
            break
        if i == n - 1 and j == n -1:
            print('Yes')
            for i in range(1,n):
                michi= get_path(0,i,p)
                print(michi[-2]+1)


### FIXED CODE ###

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

for _ in range(m):
    a,b=map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

from collections import deque

def bfs(u):
    queue = deque([u])
    d=[-1]*n
    pre=[-1]*n
    d[u]=0
    while queue:
        v=queue.popleft()
        for i in g[v]:
            if d[i] is -1:
                if pre[i] == -1:
                    pre[i]=v
                d[i]=d[v]+1
                queue.append(i)
    return d,pre
d,pre=bfs(0)
print('Yes')

for i in range(n):
    if i==0:
        continue
    print(pre[i]+1)
# coding:UTF-8
import sys
from math import factorial

MOD = 10 ** 9 + 7
INF = float('inf')

# ユニオンファインド木
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.rank = [0] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        elif self.rank[x] > self.rank[y]:
            self.parents[x] += self.parents[y]
            self.parents[y] = x
        else:
            self.parents[y] += self.parents[x]
            self.parents[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = list(map(int, input().split()))     # スペース区切り連続数字
AB = [list(map(int, input().split())) for _ in range(M)]     # スペース区切り連続数字(行列)

un = UnionFind(N)
for a, b in AB:
    un.union(a, b)

g = len(un.roots())

print("{}".format(g-1))


### FIXED CODE ###

# coding:UTF-8
import sys
from math import factorial

MOD = 10 ** 9 + 7
INF = float('inf')

# ユニオンファインド木
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.rank = [0] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        elif self.rank[x] > self.rank[y]:
            self.parents[x] += self.parents[y]
            self.parents[y] = x
        else:
            self.parents[y] += self.parents[x]
            self.parents[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = list(map(int, input().split()))     # スペース区切り連続数字
AB = [list(map(int, input().split())) for _ in range(M)]     # スペース区切り連続数字(行列)

un = UnionFind(N)
for a, b in AB:
    un.union(a-1, b-1)

g = len(un.roots())

print("{}".format(g-1))
import sys
input = sys.stdin.readline

n = int(input())
ab = [[ (int(i)-1) for i in input().split()] for i in range(n-1)]
c = sorted([int(i) for i in input().split()], reverse=True)

dic = {}
for i in range(n):
    dic[i] = []

cnt = [0]*n
for a,b in ab:
    dic[a].append(b)
    dic[b].append(a)
    cnt[a] += 1
    cnt[b] += 1

c_idx = 0
res = 0
res_arr = [""]*n
used = [0]*n
def f(idx):
    global c_idx, res, used
    used[idx] = 1
    res_arr[idx] = str(c[c_idx])
    for x in dic[idx]:
        if used[x] == 0:
            c_idx += 1
            res += c[c_idx]
            f(x)

f(cnt.index(1))
print(res)
print(" ".join(res_arr))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(11000)

n = int(input())
ab = [[ (int(i)-1) for i in input().split()] for i in range(n-1)]
c = sorted([int(i) for i in input().split()], reverse=True)

if n==1:
    print(0)
    print(c[0])
    exit()

dic = {}
for i in range(n):
    dic[i] = []

cnt = [0]*n
for a,b in ab:
    dic[a].append(b)
    dic[b].append(a)
    cnt[a] += 1
    cnt[b] += 1

c_idx = 0
res = 0
res_arr = [""]*n
used = [0]*n
def f(idx):
    global c_idx, res, used
    used[idx] = 1
    res_arr[idx] = str(c[c_idx])
    for x in dic[idx]:
        if used[x] == 0:
            c_idx += 1
            res += c[c_idx]
            f(x)

f(cnt.index(1))
print(res)
print(" ".join(res_arr))
pritn(-int(input())%1000)

### FIXED CODE ###

print(-int(input())%1000)
# -*- coding: utf-8 -*-
a, b = input().split()
pirnt("{}{}".format(b,a))


### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b = input().split()
print("{}{}".format(b,a))
#coding:utf-8
import math
a = int(input())

gcd = math.gcd
g = gcd(a,2)
l = a * 2 // g
print(l)


### FIXED CODE ###

#coding:utf-8
a = int(input())

def gcd(a, b):

	while b:

		a, b = b, a % b

	return a

g = gcd(a,2)
l = a * 2 // g
print(l)
#!/usr/bin/env python3
import sys
import string

def solve(N: int):
    alphabet = string.ascii_lowercase
    digits = []
    nextDigits = []
    last = 0
    for i in range(10):
        nd = 26**i + last
        last = nd
        if nd <= N:
            digits.append(nd)
            nextDigits.append(26**i)
        else:
            break
    # print(digits)
    s = ""
    # print(digits)
    for i in range(len(digits)-1,-1,-1):
        isFirstDigit = i == len(digits)-1
        if isFirstDigit:
            currentBaseNum = digits[i]
            index = (N-currentBaseNum)//nextDigits[i]
            s += alphabet[index]
            N = N - currentBaseNum - index * nextDigits[i]
        else:
            index = N //nextDigits[i]
            s+= alphabet[index]
            N = N - index * nextDigits[i]
    return s

# print(solve(26))
# s = ""
# for i in range(1000):
#     s += " " +solve(i)
# print(s)
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import string

def solve(N: int):
    alphabet = string.ascii_lowercase
    digits = []
    nextDigits = []
    last = 0
    for i in range(1000):
        nd = 26**i + last
        last = nd
        if nd <= N:
            digits.append(nd)
            nextDigits.append(26**i)
        else:
            break
    # print(digits)
    s = ""
    # print(digits)
    for i in range(len(digits)-1,-1,-1):
        isFirstDigit = i == len(digits)-1
        if isFirstDigit:
            currentBaseNum = digits[i]
            index = (N-currentBaseNum)//nextDigits[i]
            s += alphabet[index]
            N = N - currentBaseNum - index * nextDigits[i]
        else:
            index = N //nextDigits[i]
            s+= alphabet[index]
            N = N - index * nextDigits[i]
    return s

# print(solve(26))
# s = ""
# for i in range(100000):
#     s += " " +solve(i)
# print(s)
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))

if __name__ == '__main__':
    main()
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
n , k = map(int , input().split())
arr = list(map(int , input().split()))
dic = defaultdict(int)
for i in range(1,n+1):
	dic[i] = arr[i-1]
cycle = []
visited = [False]*(10**6)
curr = 1
if k <= n:
	curr = 1
	count = 0
	while count != k:
		curr = dic[count]
		count+=1
	exit(print(curr))
while True:
	cycle.append(curr)
	visited[curr] = True
	curr = dic[curr]
	#k -= 1
	if visited[curr]:
		break

csize = 0
ind = 0
for i in range(len(cycle)-1,-1,-1):
	if cycle[i] == curr:
		ind = i + 1
		break
	csize += 1
'''
offset = len(cycle) - csize - 1
#print(cycle,csize+1, k , curr,offset)
k -= offset
k %= csize + 1
print(cycle[offset + k])
'''
print(cycle[ind + ((k-ind)%csize)])


### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
n , k = map(int , input().split())
arr = list(map(int , input().split()))
dic = defaultdict(int)
for i in range(1,n+1):
	dic[i] = arr[i-1]
cycle = []
visited = [False]*(10**6)
curr = 1
while True:
	cycle.append(curr)
	visited[curr] = True
	curr = dic[curr]
	#k -= 1
	if visited[curr]:
		break

csize = 0
ind = 0
for i in range(len(cycle)-1,-1,-1):
	if cycle[i] == curr:
		ind = i + 1
		break
	csize += 1
offset = len(cycle) - csize - 1
#print(cycle,csize+1, k , curr,offset)
if k - offset < 0:
	exit(print(cycle[k]))
k -= offset
k %= csize + 1
print(cycle[offset + k])
N=int(input())
L=list(map(int,input().split()))
counter=0
t=0
for p in range (30):
  t=0
  for i in range(N):
    if L[i]%2==0:
      t+=1
  if t==N:
    for i in range(N):
      L[i]=int(L[i]/2)
    counter+=1
print(counter)

### FIXED CODE ###

S=str(input())
a=0
if S[0]=="1":
  a+=1
if S[1]=="1":
  a+=1
if S[2]=="1":
  a+=1
print(a)
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
    
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N, M = map(int,input().split())
A = list(map(int,input().split()))
B = []
'''
for i in range(N):
        '''
        a = factorization(A[i]) 
        B.append(A[i] // (2**a[0][1]))
        '''
        while A[i] % 2 == 0:
                A[i] //= 2
'''
a = lcm(*A)
#print(a)

if a > M or a % 4 != 0:
        print(0)
        exit(0)
'''
for i in range(a,M+1,a*2):
    #print(i)
    i = float(i)
    flag = 0
    for j in A:
        #print((i / j)-0.5)
        if ((i / j)-0.5).is_integer() == False:
            flag = 1
    if flag == 0 and 0 <= (i / j)-0.5:
        break
'''
print(int((M-a//2) // a + 1))

### FIXED CODE ###

import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
    
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


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

#if gcd(*A) % 2 != 0:
    #print(0)
    #exit(0)

#sisu_2 = factorization(A[0])[0][1] 

#lcm_a = lcm(*A)
#lcm_a_half = lcm_a // 2
lcm_a = lcm(*A) // 2

l = []
sisu_a0 = 0
for i in range(N):
    sisu = 0
    while A[i]%2==0:
        A[i] //= 2
        sisu += 1
    
    if sisu_a0==0:
        sisu_a0 = sisu
    else:
        if sisu_a0!=sisu:
            print(0)
            exit()
#if (lcm_a % (2**sisu_2) == 0) or lcm_a > M:
#if factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M:
if lcm_a > M:
    print(0)
    exit(0)
else:
    print(int((M-lcm_a) // (lcm_a*2) + 1))
ball = lst[0]
blue = lst[1]
red = lst[2]
blue_red = int(ball / (red + blue)) + 1

blue_str = ''
for i in range(blue): blue_str += 'b'
red_str = ''
for i in range(red): red_str += 'r'

mojiretu = ''
for i in range(blue_red): mojiretu += (blue_str + red_str)
print(mojiretu[:ball].count('b'))

### FIXED CODE ###

lst = [int(i) for i in input().split()]
ball = lst[0]
blue = lst[1]
red = lst[2]

red_blue = int(ball / (red + blue))
shokichi = red_blue * blue
amari = ball - (red_blue * (red + blue))

if amari < blue:
    nokori = amari
elif amari > blue:
    nokori = blue
else:
    nokori = 0

if blue == 0:
    print(0)
else:
    print(shokichi + nokori)
a,b,k = map(int, input().split())
x = list(range(a,b+1))
y = x[0:k]
z = x[len(x)-k:len(x)]
a = []
for i in range(len(y)):
    a.append(y[i])
for i in range(len(z)):
    a.append(z[i])
a_uniq = []
for i in a:
    if i not in a_uniq:
        a_uniq.append(i)
for i in range(len(a_uniq)):
    print(a_uniq[i])

### FIXED CODE ###

a, b, k = map(int, input().split())
if b - a + 1 <= 2 * k:
    result = ([i for i in range(a, b + 1)])
else:
    result = ([i for i in range(a, a + k)] + [i for i in range(b - k + 1, b + 1)])
for i in result:
    print(i)
n = input()
for i in range(int(n), 1000):
  if i.count(n[0]) == 3:
    print(i)
    exit()

### FIXED CODE ###

n = input()
for i in range(int(n), 1000):
  if str(i).count(str(i)[0]) == 3:
    print(i)
    exit()
S = input()
print(min(S.count('1'), S.count('0'))

### FIXED CODE ###

S = input()
s = [int(S[i:i + 1]) for i in range(len(S))]
ans = 0
v1 = s[0]
index = []
index.append(0)
for i in range(1, len(s)):
    if v1 != s[i] and len(index) != 0:
        ans += 2
        index.pop(-1)
        if len(index) != 0:
            v1 = s[index[-1]]
        else:
            v1 = 10
    else:
        index.append(i)
        v1 = s[i]
print(ans)
a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<=t and not i ==t]
num = sum(sum_list)%mod
print(num)

### FIXED CODE ###

a,b,c  = map(int,input().split())
if a <= b*c:
    print('Yes')
else:
    print('No')
n=int(input())

field=[[0 for i in range(20)] for j in range(15)]



for i in range (n):
     b,f,r,v=map(int,input().split())
     field[(b-1)*4+f-1][r*2-1]+=v
for i in range(15):
     for j in range(20):
          if y%4==3:field[y][x]='#'
          elif x%2==0:field[y][x]=' '
　　　print ( field[y][x],end="")
     print()


### FIXED CODE ###

n=int(input())
field=[[0 for i in range(20)]for j in range(15)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    h=(b-1)*4+f-1
    w=r*2-1
    n=v
    field[h][w]+=n
for y in range(15):
    for x in range(20):
        if(y%4==3):field[y][x]='#'
        elif x%2==0 :field[y][x]=' '
        print(field[y][x],end='')
    print()
import itertools
import math
N = int(input())
p = []
for i in range(N):
    x, y = map(int, input().split())
    p.append([x, y])
S = list(itertools.combinations(p,3))
T = list(itertools.combinations(p,2))
ans = 10000
for X in S:
    ok = True
    a = X[0][0]
    b = X[0][1]
    c = X[1][0]
    d = X[1][1]
    e = X[2][0]
    f = X[2][1]
    py = ((e-a)*(a**2+b**2-c**2-d**2)-(c-a)*(a**2+b**2-e**2-f**2))/(2*(e-a)*(b-d)-2*(c-a)*(b-f))
    if c == a:
        px = (2*(b-f)*py-(a**2+b**2-e**2-f**2))/(2*(e-a))
    else:
        px = (2*(b-d)*py-(a**2+b**2-c**2-d**2))/(2*(c-a))
    r = math.sqrt((px-a)**2+(py-b)**2)
    for Y in p:
        if r**2 < (px-Y[0])**2 + (py-Y[1])**2:
            ok = False
    if ok:
        ans = min(ans, r)
for X in T:
    a = X[0][0]
    b = X[0][1]
    c = X[1][0]
    d = X[1][1]
    ok = True
    px = (a+c)/2
    py = (b+d)/2
    r = math.sqrt((px-a)**2+(py-b)**2)
    for Y in p:
        if r**2 < (px-Y[0])**2 + (py-Y[1])**2:
            ok = False
    if ok:
        ans = min(ans, r)
print(ans)

### FIXED CODE ###

import itertools
import math
N = int(input())
p = []
for i in range(N):
    x, y = map(int, input().split())
    p.append([x, y])
ans = 10000
if len(p) >= 3:
    S = list(itertools.combinations(p,3))
    for X in S:
        ok = True
        a = X[0][0]
        b = X[0][1]
        c = X[1][0]
        d = X[1][1]
        e = X[2][0]
        f = X[2][1]
        if (a-c)*(b-f) == (a-e)*(b-d):
            continue
        py = ((e-a)*(a**2+b**2-c**2-d**2)-(c-a)*(a**2+b**2-e**2-f**2))/(2*(e-a)*(b-d)-2*(c-a)*(b-f))
        if c == a:
            px = (2*(b-f)*py-(a**2+b**2-e**2-f**2))/(2*(e-a))
        else:
            px = (2*(b-d)*py-(a**2+b**2-c**2-d**2))/(2*(c-a))
        r = math.sqrt((px-a)**2+(py-b)**2)
        for Y in p:
            if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
                ok = False
        if ok:
            ans = min(ans, r)
T = list(itertools.combinations(p,2))
for X in T:
    a = X[0][0]
    b = X[0][1]
    c = X[1][0]
    d = X[1][1]
    ok = True
    px = (a+c)/2
    py = (b+d)/2
    r = math.sqrt((px-a)**2+(py-b)**2)
    for Y in p:
        if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
            ok = False
    if ok:
        ans = min(ans, r)
print(ans)
a,b,c,d=,map(int,input(),split())
hpa=a
hpc=c
while (hpa!=0) and (hpc!=0):
  hpa=hpa-c
  hpc=hpc-a

if hpa=0:
  print("No")

if hpc=0:
  print("Yes")
  
  

### FIXED CODE ###

a,b,c,d=map(int,input().split())
while True:
  c-=b
  if c<=0:
    print("Yes")
    break
  
  a-=d
  if a<=0:
    print("No")
    break
lst = list(map(int, input().split()))
print(sum(list[::2]))

### FIXED CODE ###

lst = sorted(list(map(int, input().split())))
print(sum(lst[:2]))
def main():
    x, y = map(int, input().split())

    if x == y:
        ans = 0
    if x >= 0 and y >= 0:
        if x < y:
            # x:1, y:3
            ans = y - x
        else:
            # x:3, y:1
            # x:-3,-2,-1,0,1
            ans = 1 + y + x
    elif x < 0 and y < 0:
        if x < y:
            # x:-3, y:-1
            ans = y - x
        else:
            # x:-1, y:-3
            # x:1,2,3,-3
            ans = 1 + abs(y - x) + 1
    elif x < 0 < y:
        if abs(x) <= y:
            # x:-3, y:4
            # x:3,4
            ans = 1 + y + x
        else:
            # x:-5, y:4
            # x:-4,4
            ans = abs(y + x) + 1
    elif x > 0 > y:
        if x >= abs(y):
            # x:3, y:-1
            # x:-3,-2,-1
            ans = 1 + x + y
        else:
            # x:3, y:-4
            ans = abs(y + x) + 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    x, y = map(int, input().split())

    ans = f(x, y)
    print(ans)


def f(x, y):
    if x == y:
        ans = 0
    elif x >= 0 and y >= 0:
        if x < y:
            # x:0, y:3
            ans = y - x
        elif y == 0:
            # x:3, y:0 -> x:-3,-2,-1,0
            ans = 1 + x
        else:
            # x:3, y:1 -> x:-3,-2,-1,1
            ans = 1 + abs(y - x) + 1
    elif x < 0 and y < 0:
        if x < y:
            # x:-3, y:0
            ans = y - x
        else:
            # x:-2, y:-3 -> x:  2,3,-3
            ans = 1 + abs(y - x) + 1
    elif x < 0 and y == 0:
        # x:-5, y:0 -> x:-4,-3,-2,-1,0
        ans = abs(x)
    elif x < 0 < y:
        if abs(x) <= y:
            # x:-1, y:4 -> x:1,2,3,4
            ans = 1 + y + x
        else:
            # x:-5, y:4 -> x:-4,4
            ans = abs(y + x) + 1
    elif x == 0 and y < 0:
        # x:0, y:-4 -> x:1,2,3,4,-4
        ans = abs(y) + 1
    elif x > 0 > y:
        if x >= abs(y):
            # x:3, y:-1 -> x:-3,-2,-1
            ans = 1 + x + y
        else:
            # x:3, y:-4 -> x:      4,-4
            ans = abs(y + x) + 1

    return ans


def note():
    """
    x,yについて =0,<0,0> の全列挙
    3*3=9
    例外:x == y

    x == 0 and y == 0(例外に含まれる)
    x == 0 and y >  0
    x == 0 and y <  0

    x >  0 and y == 0
    x >  0 and y >  0
    x >  0 and y <  0

    x <  0 and y == 0
    x <  0 and y >  0
    x <  0 and y <  0

    実装しやすさによって、<=,>=を変更
    """


if __name__ == '__main__':
    main()
from scipy.sparse.csgraph import dijkstra as di

inf = float('INF')


n,m,l = map(int,input().split())

route = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a,b,c = map(int, input().split())
    route[a-1][b-1] = route[b-1][a-1] = c

p_route = di(route)
for i in range(n):
    for j in range(n):
        if p_route[i][j] == inf:
            continue
        elif p_route[i][j] <= l:
            p_route[i][j] = 1
p_route = di(p_route)

query = []
q = int(input())
ans = []
for _ in range(q):
    s,t = map(int, input().split())
    print(-1 if p_route[s-1][t-1] == inf else p_route[s-1][t-1])


### FIXED CODE ###

from scipy.sparse.csgraph import dijkstra as di

inf = float('INF')
n,m,l = map(int,input().split())

route = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a,b,c = map(int, input().split())
    route[a-1][b-1] = route[b-1][a-1] = c

p_route = di(route)
p_route[p_route == 0] = inf
p_route[l >= p_route] = 1
p_route[l < p_route] = 0
p_route = di(p_route)

# print(p_route)
query = []
q = int(input())
ans = []
for _ in range(q):
    s,t = map(int, input().split())
    print(-1 if p_route[s-1][t-1] == inf else int(p_route[s-1][t-1]) - 1)
a,b,x = map(int,input().split())
syo = -1
dai = 10**9+1
ans = 0
while abs(dai-syo)!=1:
    n = (dai+syo)//2
    en = a*n+b*len(str(int(n)))
    if en > x:
        dai = n
    else:
        ans = syo = n
print(ans)

### FIXED CODE ###

d = {"SUN":1,"MON":2,"TUE":3,"WED":4,"THU":5,"FRI":6,"SAT":7}
print(8-d[input()])