Harryxun/stf_run huggingface dataset:
from sys import stdin


class DFS():
    def __init__(self,N,S):
        self.N = N
        self.S = S
        self.seen = [False] * self.N
        self.cnt = [0] * self.N

    def dfs(self, i):
        if i == self.N-1:
            return 1
        elif i > self.N-1:
            return 0
        elif self.seen[i]:
            return self.cnt[i]
        else:
            cnt = 0
            for s in self.S:
                cnt += self.dfs(i+s)
            else:
                self.cnt[i] = cnt
                self.seen[i] = True
            return self.cnt[i]


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, K = list(map(int, _in[0].split(' ')))  # type:list(int)
    L_R_arr = []
    for i in range(K):
        _ = list(map(int, _in[i+1].split(' ')))  # type:list(int)
        L_R_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    ans = 0
    S = []
    for L, R in L_R_arr:
        S.extend([i for i in range(L, R+1)])
    S = sorted(set(S))
    dfs = DFS(N, S)
    dfs.dfs(0)
    ans = dfs.cnt[0] % 998244353
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin
import sys
sys.setrecursionlimit(10**7)


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, K = list(map(int, _in[0].split(' ')))  # type:list(int)
    L_R_arr = []
    for i in range(K):
        _ = list(map(int, _in[i+1].split(' ')))  # type:list(int)
        L_R_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    dp = [0] * N
    sdp = [0] * (N+1)
    dp[0] = 1
    for i in range(N):
        for L, R in L_R_arr:
            right = max(0, i-L+1)
            left  = max(0, i-R)
            dp[i] += sdp[right] - sdp[left]
        else:
            sdp[i+1] = (sdp[i] + dp[i]) % 998244353
    ans = dp[-1] % 998244353
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()
money=input()
sum=input()
money500=500*money
if money500>=sum:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

money,sum=map(int,input().split())
money500=500*money
if money500>=sum:
    print('Yes')
else:
    print('No')
count=0
N=int(input())
d=[]
d=[int(input()) for i in range(N)]
for k in range (N-1):
    for j in range(k+1,N-1):
         dd1=d[k]
         dd2=d[j]
         if dd1==dd2 :break
    else:count+=1
print(count)

### FIXED CODE ###

S=input().split("/")
print("2018/"+S[1]+"/"+S[2])
import heapq

X,Y,Z,K = map(int, input().split())
A = [int(x) for x in  input().split()]
B = [int(x) for x in  input().split()]
C = [int(x) for x in  input().split()]

A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

h = []

heapq.heappush(h, (A[0]+B[0]+C[0], 0,0,0))

result = []

for _ in range(K):
	value, i,j,k = heapq.heappop(h)
    result.append(value)
    if i < X-1:
    	heapq.heappush(h, (A[i+1]+B[j]+C[k],i,j,k))
    if j < Y-1 and i == 0:
      	heapq.heappush(h, (A[i]+B[j+1]+C[k],i,j+1,k))
    if k < Z-1 and i == 0 and j == 0:
      	heapq.heappush(h, (A[i]+B[j]+C[k+1],i,j,k+1))
        
for v in result:
	print(v)

### FIXED CODE ###

import heapq

X,Y,Z,K = map(int, input().split())
A = [int(x) for x in  input().split()]
B = [int(x) for x in  input().split()]
C = [int(x) for x in  input().split()]

A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

h = []

heapq.heappush(h, (-A[0]-B[0]-C[0], 0,0,0))

result = []
used = set()

for _ in range(K):
    value, i,j,k = heapq.heappop(h)
    result.append(-value)
    if i < X-1 and (i+1,j,k) not in used:
        heapq.heappush(h, (-A[i+1]-B[j]-C[k],i+1,j,k))
        used.add((i+1,j,k))
    if j < Y-1 and (i,j+1,k) not in used:
        heapq.heappush(h, (-A[i]-B[j+1]-C[k],i,j+1,k))
        used.add((i,j+1,k))
    if k < Z-1 and (i,j,k+1) not in used:
        heapq.heappush(h, (-A[i]-B[j]-C[k+1],i,j,k+1))
        used.add((i,j,k+1))
        
for v in result:
    print(v)
n = int(input())
string = int(input())

s1 = ""
s2 = ""

if(n % 2 == 0):
    for i, st in enumerate(string):
        if i < n/2:
            s1 = s1 + st
        else:
            s2 = s2 + st

    if s1 == s2:
        print("Yes")
    else:
        print("No")
else:
    print("No")


### FIXED CODE ###

n = int(input())
string = str(input())

s1 = ""
s2 = ""

if(n % 2 == 0):
    for i, st in enumerate(string):
        if i < n/2:
            s1 = s1 + st
        else:
            s2 = s2 + st

    if s1 == s2:
        print("Yes")
    else:
        print("No")
else:
    print("No")
def cmb(n, r, p):
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n = 4*10**5  # N は必要分だけ用意する
N = 2*n
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    if i <= n:
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
X, Y = map(int, input().split())
if (X+Y)%3 != 0:
    result = 0
else:
    result = cmb((X+Y)//3, Y-(X+Y)//3, p)
print(result)


### FIXED CODE ###

def cmb(n, r, p):
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n = 7*10**5  # N は必要分だけ用意する
N = 2*n
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    if i <= n:
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
X, Y = map(int, input().split())
if (X+Y)%3 != 0:
    result = 0
else:
    n = Y-(X+Y)//3
    m = X-(X+Y)//3
    if n<0 or m<0:
        result = 0
    else:
        result = cmb(n+m, n, p)
print(result)
K = input()
S = input()
count = 0

for x in range(int(K)):
    for y in range(int(K)):
        z = int(S) - x - y
        if 0 <= z and z <= int(K):
            count += 1

print(count)


### FIXED CODE ###

K, S = map(int, input().split())
count = 0
 
for x in range(K+1):
  for y in range(K+1):
    z = S - x - y
    if 0 <= z and z <= K:
    	count += 1
print(count)
N, K = map(int, input().split())

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    

dots = XY[:]

import sys
INT_MAX = sys.maxsize

ans = INT_MAX

import itertools
for left_d, right_d in itertools.permutations(dots, 2):
    if left_d[0] < right_d[0]:
        left_x = left_d[0]
        right_x = right_d[0]
    else:
        left_x = right_d[0]
        right_x =  left_d[0]
    
    for under_d, top_d in itertools.permutations(dots, 2):
        c += 1
        if under_d[1] < top_d[1]:
            under_y = under_d[1]
            top_y = top_d[1]
        else:
            under_y = top_d[1]
            top_y = under_d[1]
            
        counter = 0
        for d in dots:
            if  (left_x <= d[0]) and (d[0] <= right_x) and (under_y <= d[1]) and (d[1] <= top_y):
                counter += 1
                if counter >= K:
                    break
                
        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            ans = min(ans, area)
            
print(ans)


### FIXED CODE ###

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

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
dots = XY[:]

import sys
INT_MAX = sys.maxsize

ans = INT_MAX

import itertools
for ((left_x, _), (right_x, _)) in itertools.combinations(dots, 2):
    if left_x > right_x:
        left_x, right_x = right_x, left_x
    for ((_, under_y), (_, top_y)) in itertools.combinations(dots, 2):
        if under_y > top_y:
            under_y, top_y = top_y, under_y
        counter = 0
        for d_x, d_y in dots:
            if  (left_x <= d_x) and (d_x <= right_x) and (under_y <= d_y) and (d_y <= top_y):
                counter += 1
                
        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            if ans > area:
                ans = area
            
print(ans)
n = int(input())
a = list(map(int, input().split()))

import math
g = 0
for x in a:
  g = math.gcd(g, x)
print(g)


### FIXED CODE ###

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

import fractions
g = 0
for x in a:
  g = fractions.gcd(g,x)
print(g)
a,b,c = sorted (map(int,input().split())
print(10*c+b+a)

### FIXED CODE ###

a,b,c = sorted (map(int,input().split()))
print(10*c+b+a)
n,k,s=map(int,input().split())

A=[s]*k
for i in range(len(A),n):
  if s+1!+10**9:
    A.append(s+1)
  else:
    A.append(s-1)
print(*A)
  

### FIXED CODE ###

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

A=[s]*k
for i in range(len(A),n):
  if s!=10**9:
    A.append(s+1)
  else:
    A.append(1)
print(*A)
from functools import reduce
MOD = 1_000_000_007
print(reduce(lambda a,b: a*b%MOD, range(1, int(input()))))


### FIXED CODE ###

from functools import reduce
MOD = 1_000_000_007
print(reduce(lambda a,b: a*b%MOD, range(1, int(input())+1), 1))
def cost( i,k,j ):
  return m[i][k] + m[k+1][j] + p[i][0] * p[k][1] * p[j][1]
 
n = input()
M = []
m = [ [ 0 for i in range(n) ] for j in range(n) ]
for i in range(n):
  M.append( map ( int , raw_input().split() ) )

p_long = len(p)
for l in range( 2,n+1 ):
  for i in range( 0,n-l+1 ):
    j = i + l - 1
    m[i][j] = min( cost( i,k,j ) for k in range( i,j ) )
 
print m[0][p_long-1]

### FIXED CODE ###

def cost( i,k,j ):
  return m[i][k] + m[k+1][j] + M[i][0] * M[k][1] * M[j][1]
 
n = input()
M = []
m = [[ 0 for i in range(n) ] for j in range(n) ]
for i in range(n):
  M.append( map (int, raw_input().split() ) )
 
M_long = len(M)
for l in range( 2,M_long+1 ):
  for i in range( 0,M_long-l+1 ):
    j = i+l-1
    m[i][j] = min( cost( i,k,j ) for k in range( i,j ) )
 
print m[0][M_long-1]
n=int(input())
t=list(int(input().split()))
m=int(input())
px = [list(map(int, input().split())) for _ in range(m)]

for i in range(m):
    t[px[i][0]]=px[i][1]
    print(sum(t))

### FIXED CODE ###

n=int(input())
t=list(map(int,input().split()))
sumt=sum(t)
m=int(input())
px = [list(map(int, input().split())) for _ in range(m)]
for i in range(m):   
    a=t[px[i][0]-1]
    b=px[i][1]
    print(sumt-a+b)
n=int(input())
xl = [list(map(int,input().split())) for i in range(n)]
xl.sort()
def OK(list):
  for i in range(n-1):
    if list[i][0]+list[i][1] > list[i+1][0]-list[i+1][1]:
      return False
  return True

while OK(xl)==False:
  r=len(xl)
  memo=[0]*r
  for i in range(r-1):
    if memo[i]==0 and xl[i][0]+xl[i][1]>xl[i+1][0]-xl[i+1][1]:
      memo[i+1] += 1
  for i in range(r):
    if memo[r-1-i]==1:
      del xl[r-1-i]
print(len(xl))

### FIXED CODE ###

n=int(input())
xl=[list(map(int,input().split())) for i in range(n)]
xl=[i+[i[0]-i[1],i[0]+i[1]] for i in xl] # [point,arm,left,right]
xl.sort(key=lambda x: x[3])
i=0
ans=n
while i<len(xl)-1:
  if xl[i][-1]>xl[i+1][2]:
    del xl[i+1]
    ans-=1
  else:
    i+=1
print(ans)
I,i,R=input,int,range
n,L,R,A,C=i(I()),[],[],0,0
for _ in R(n):l,r=map(i,I().split());L+=[l];R+=[r]
L=sorted(l)[::-1];R.sort()
for j in R(n):C+=(L[j]-R[j])*2;A=max(A,C)
print(A)

### FIXED CODE ###

I,i,H=input,int,range
n,L,R,A,C=i(I()),[0],[0],0,0
for _ in H(n):l,r=map(i,I().split());L+=[l];R+=[r]
L=sorted(L)[::-1];R.sort()
for j in H(n//2+1):C+=(L[j]-R[j])*2;A=max(A,C)
print(A)
N,K = map(int,input().split())
mod = 10e9 + 7
ans = 0
cnt_arr = [0]*(K+1)
for i in range(K,0,-1):
  cnt = (K//i)**N%mod
  j = 2
  while i*j<=K:
    cnt -= cnt_arr[i*j]
    j+=1
  cnt_arr[i]=cnt
  ans += i*cnt

print(int(ans%mod))

### FIXED CODE ###

N,K = map(int,input().split())
m = 10**9 + 7
ans = 0
cnt_arr = [0]*(K+1)
for i in range(K,0,-1):
  cnt = pow(int(K//i), N, mod=m)
  j = 2
  while i*j<=K:
    cnt -= cnt_arr[i*j]
    j+=1
  cnt_arr[i]=cnt
  ans += i*cnt

print(int(ans%m))
import numpy as np
 
def main(H, W, s_list):
    row_count = np.zeros((H, W))
    for i_row in range(H):
        i_col = 0
        j_col = 0
        s = s_list[i_row]
        while(i_col < W):
            char = s[i_col]
            j_col = i_col
            
            if char == '.':
                while(True):
                    j_col += 1
                    if j_col == W:
                        break
                    c = s[j_col]
                    if c == '#':
                        break
 
                row_count[i_row, i_col:j_col] = j_col - i_col
            i_col = j_col + 1
 
 
    col_count = np.zeros((H, W))
    for i_col in range(W):
        i_row = 0
        j_row = 0
        s_col = [s[i_col] for s in s_list]
        while(i_row < H):
            char = s_col[i_row]
            j_row = i_row
            if char == '.':
                while(True):
                    j_row += 1
                    if j_row == H:
                        break
                    c = s_col[j_row]
                    if c == '#':
                        break
                
                col_count[i_row:j_row, i_col] = j_row - i_row
            i_row = j_row + 1
    print(int(np.max(row_count + col_count)) - 1)
 
 
 
if __name__ == "__main__":
    H, W = [int(x) for x in input().split()]
    s_list = []
    for _ in range(H):
        s_list.append(input())
 
    main(H, W, s_list)

### FIXED CODE ###


def main(H, W, s_list):
    row_count = [[0]*W for _ in range(H)]
    for i_row in range(H):
        i_col = 0
        j_col = 0
        s = s_list[i_row]
        while(i_col < W):
            char = s[i_col]
            j_col = i_col
            
            if char == '.':
                while(True):
                    j_col += 1
                    if j_col == W:
                        break
                    c = s[j_col]
                    if c == '#':
                        break
                
                for k in range(i_col, j_col):
                    row_count[i_row][k] = j_col - i_col
            i_col = j_col + 1


    col_count = [[0]*W for _ in range(H)]
    for i_col in range(W):
        i_row = 0
        j_row = 0
        s_col = [s[i_col] for s in s_list]
        while(i_row < H):
            char = s_col[i_row]
            j_row = i_row
            if char == '.':
                while(True):
                    j_row += 1
                    if j_row == H:
                        break
                    c = s_col[j_row]
                    if c == '#':
                        break
                for k in range(i_row, j_row):
                    col_count[k][i_col] = j_row - i_row
            i_row = j_row + 1

    m = 0
    for i_row in range(H):
        for i_col in range(W):
            sumation = row_count[i_row][i_col] + col_count[i_row][i_col]
            if sumation > m:
                m = sumation
    print(int(m) - 1)



if __name__ == "__main__":
    H, W = [int(x) for x in input().split()]
    s_list = []
    for _ in range(H):
        s_list.append(input())

    main(H, W, s_list)
a, b = map(int, input())
if((a*b)%2 == 0):
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if((a*b)%2 == 0):
    print("Even")
else:
    print("Odd")
N, M = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(M)]

INF = 1 << 60
cost = [- INF] * (N + 1)
cost[1] = 0

for i in range(N):
    for n, nn, c in edge:
        if cost[nn] < cost[n] + c:
            # ワーシャルフロイド法の性質より、N回目に更新があるならinf
            if i == N - 1 and nn == N:
                print("inf")
                sys.exit()
            cost[nn] = cost[n] + c

print(cost[N])

### FIXED CODE ###

import sys
N, M = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(M)]

INF = 1 << 60
cost = [- INF] * (N + 1)
cost[1] = 0

for i in range(N):
    for n, nn, c in edge:
        if cost[nn] < cost[n] + c:
            # ワーシャルフロイド法の性質より、N回目に更新があるならinf
            if i == N - 1 and nn == N:
                print("inf")
                sys.exit()
            cost[nn] = cost[n] + c

print(cost[N])
n = int(read())
v = [[] for i in range(n+1)] # 邻接
used = [0 for i in range(n+1)] # 节点 1~n
def add(f,t,w):
    v[f].append((t, w))
    
for i in range(n-1):
    f,t,w = map(int, read().split())
    add(f,t,w)
    add(t,f,w)
# 从1出发，贪心即可，1画1，理论不会有回环
def dfs(f, s, fa=-1):
    if s % 2 == 0: 
        used[f] = 1
    for t, w in v[f]:
#         print('%d->%d->%d'%(fa, f, t,), s, w)
        if t == fa:continue
        dfs(t, w + s, f)
dfs(1,0)
for i in used[1:]:
    print(used[i])

### FIXED CODE ###

read = input
n = int(read())
v = [[] for i in range(n+1)] # 邻接
used = [0 for i in range(n+1)] # 节点 1~n
def add(f,t,w):
    v[f].append((t, w))
for i in range(n-1):
    f,t,w = map(int, read().split())
    add(f,t,w)
    add(t,f,w)
# 从1出发，贪心即可，1画1，理论不会有回环
# def dfs(f, s, fa=-1):
#     if s % 2 == 0: 
#         used[f] = 1
#     for t, w in v[f]:
# #         print('%d->%d->%d'%(fa, f, t,), s, w)
#         if t == fa:continue
#         dfs(t, w + s, f)
from queue import Queue
q = Queue()
#def dfs(f, s, fa=-1):
#    if s % 2 == 0: 
#        used[f] = 1
#    for t, w in v[f]:
##         print('%d->%d->%d'%(fa, f, t,), s, w)
#        if t == fa:continue
#        dfs(t, w + s, f)
#
#
#dfs(1,0)
q.put_nowait((1, 0, -1))
while not q.empty():
    f, s, fa = q.get_nowait()
    if s % 2 == 0: 
        used[f] = 1
    for t, w in v[f]:
#         print('%d->%d->%d'%(fa, f, t,), s, w)
        if t == fa:continue
        q.put_nowait(
            (t, w + s, f)
        )
    
for i in used[1:]:
    print(used[i])
rectangles = 0 ; lozenges = 0
while True:
	try:
		a,b,c, = map(int,raw_input().split(','))
		if a*a + b*b = c*c: rectangle += 1
		else:
			if a = b: lozenges += 1
	except: break
print rectangles ; print lozenges

### FIXED CODE ###

rectangles = 0 ; lozenges = 0
while True:
	try:
		a,b,c, = map(int,raw_input().split(','))
		if a*a + b*b == c*c: rectangles += 1
		else:
			if a == b: lozenges += 1
			else: pass
	except: break
print rectangles ; print lozenges
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(-1)
    sys.exit()
aa=0
s=n//(a+b)
n=n%((a+b)*s)#余り
if n<a:
    print(s*a+n)
else:
    print(s*a+a)


### FIXED CODE ###

#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    if s==0:
        m=n
    else:
        absum=(a+b)*s
        m=n%(absum)#余り
    if m<a:
        print(s*a+m)
    else:
        print((s+1)*a)
# coding:utf8

N = int(input())
A = list(map(int, input().strip().split()))
s = 0
for i in range(N):
    s += 1.0/(A[i])
s = 1.0/s

print(s)

### FIXED CODE ###

# coding:utf-8
 
num = int(input())
chr = input()
 
if num>=3200:
  print(chr)
else:
  print("red")
import math
def undefinedfunction():
  asjdkfl
A,B,X=map(int,input().split())
last=[]
for i in range(0,10):
  last.append(A*(10**i)+B*(i+1))
digit=0
for i in range(0,10):
  if X>=last[i]:
    digit=digit+1
if digit==0:
  print(0)
elif digit>=10:
  undefined
  print(1000000000)
else:
  k=math.floor((X-B*(digit-1))/A)
  if (k+1)*A<=X-B*(digit-1):
    k+=1
    undefinedfunction
  if k<10**(digit-1):
    k=10**(digit-1)
  if k>=10**digit:
    k=10**digit-1
    undefinedfunction
  print(k)

### FIXED CODE ###

S=input()
if S=='SUN':
  print(7)
if S=='MON':
  print(6)
if S=='TUE':
  print(5)
if S=='WED':
  print(4)
if S=='THU':
  print(3)
if S=='FRI':
  print(2)
if S=='SAT':
  print(1)
from math import factorial
 
def comb(n, k):
  return factorial(n)/factorial(n-k)/factorial(k)
 
N, K = map(int, input().split())
 
for i in range(1, K+1):
  if N-K-i+1 < 0:
    print(0)
  else:
    a = comb(N-K+1, i)%(10**9+7)
    b = comb(K-1, i-1)%(10**9+7)
    print(int((a*b)%(10**9+7)))

### FIXED CODE ###

from math import factorial
 
def comb(n, k):
  return int(factorial(n))//int(factorial(n-k))//int(factorial(k))
 
N, K = map(int, input().split())
 
for i in range(1, K+1):
  if N-K-i+1 < 0:
    print(0)
  else:
    a = comb(N-K+1, i)%(10**9+7)
    b = comb(K-1, i-1)%(10**9+7)
    print(int((a*b)%(10**9+7)))
import numpy as np

N, M = map(int, input().split())
A = np.full((N, M), 0)
for i in range(N):
    Ka = map(int, input().split())
    a = Ka[1:]
    for j in a:
        A[i, j-1] = 1
        
print(np.sum(np.prod(A, axis=0)))
        

### FIXED CODE ###

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

like = [1] * M

for i in range(N):
    K, *A = map(int, input().split())
    for i in range(M):
        if i + 1 not in A:
            like[i] = 0
print(sum(like))
from collections import defaultdict as d
p=d(str)
n=int(input())
print(0, flush = True)
s = input()
if s == "Vacant": exit()
else:
    print(n-1,flush=True)
    t=input()
    if t == "Vacant": exit()
    else:
        p[0]=s
        p[n-1]=t
        l=0
        r=n-1
        while 1:
            g=(l+r)//2
            if p[l]=="":
                print(l, flush = True)
                s = input()
                p[l]=s
                if s == "Vacant": exit()
                else:
                    s=p[l]
            if p[g]=="":
                print(g, flush = True)
                t = input()
                p[g]=t
                if t == "Vacant": exit()
                else:
                    t=p[g]
            if ((g-l)%2!=0 and s!=t) or ((g-l)%2!=1 and s==t):
                l=g+1
            else:
                r=g-1


### FIXED CODE ###

x,y=map(int,input().split())
print(x if x%y!=0else-1)
s = input()

if s[0] == "h" and s[1] == "i" and s[1] != s[2]:
    print("Yes")

else:
    print("No")
    

### FIXED CODE ###

s = input()
i = int(len(s) / 2)
if "hi" * i == s:
    print("Yes")

else:
    print("No")
n = int(input())
house = []
for i in range(4):
    house.append([])
    for j in range(3):
        house[i].append([])
        for k in range(10):
            house[i][j].append(0)

for i in range(n):
    b,f,r,v = map(int,input().split())
    house[b][f][r] += v


for i in range(4):
    for j in range(3):
        for k in range(10):
            print("" + house[i][j][k], end="")
        print()
    if b < 3:
        print("#" * 20)

### FIXED CODE ###

n = int(input())
house = []
for i in range(4):
    house.append([])
    for j in range(3):
        house[i].append([])
        for k in range(10):
            house[i][j].append(0)

for i in range(n):
    b,f,r,v = map(int,input().split())
    house[b-1][f-1][r-1] += v


for i in range(4):
    for j in range(3):
        for k in range(10):
            print("" , house[i][j][k], end="")
        print()
    if i < 3:
        print("#" * 20)
s, t, u = map(str, input().split())

print(s.upper[0]+t.upper[0]+u.upper[0])

### FIXED CODE ###

s, t, u = map(str, input().split())

print(s.upper()[0]+t.upper()[0]+u.upper()[0])
n, m = map(int, input().split())
A = list(map(int, input().split()))
all = sum(A)

cnt = 0
for x in A:
  if 4 * m * A[i] >= all:
    cnt++;
  
if cnt >= m:
  print("Yes")
else :
  print("No")


### FIXED CODE ###

n, m = map(int, input().split())
A = list(map(int, input().split()))
all = sum(A)

cnt = 0
for x in A:
  if 4 * m * x >= all:
    cnt += 1
  
if cnt >= m:
  print("Yes")
else :
  print("No")
a, b, h = map(int, input().split())

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

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2))
N = map( int , raw_input().split() )
 
if N[0] < N[1] < N[2]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[0] < N[2] < N[1]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[1] < N[0] < N[2]:
  print "%d %d %d" %(N[1],N[0],N[2])
elif N[1] < N[2] < N[0]:
  print "%d %d %d" %(N[1],N[2],N[0])
elif N[2] < N[0] < N[1]:
  print "%d %d %d" %(N[2],N[0],N[1])
else N[2] < N[1] < N[0]:
  print "%d %d %d" %(N[2],N[1],N[0])

### FIXED CODE ###

N = map( int , raw_input().split() )
 
if N[0] < N[1] < N[2] or N[0] == N[1] == N[2] or N[0] < N[1] == N[2] or N[0] == N[1] < N[2]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[0] < N[2] < N[1]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[1] < N[0] < N[2]:
  print "%d %d %d" %(N[1],N[0],N[2])
elif N[1] < N[2] < N[0] or N[1] < N[2] == N[0] or N[1] == N[2] < N[0]: 
  print "%d %d %d" %(N[1],N[2],N[0])
elif N[2] < N[0] < N[1] or N[2] < N[0] == N[1] or N[2] == N[0] < N[1]:
  print "%d %d %d" %(N[2],N[0],N[1])
elif N[2] < N[1] < N[0]:
  print "%d %d %d" %(N[2],N[1],N[0])