Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    if a <= c <= b:
        print("Yes")
        return
    print("No")
    return

#B
def B():
    n, m = LI()
    e = defaultdict(int)
    for i in range(1, n + 1): e[i] = 0
    for i in range(m):
        a, b = LI()
        e[a] += 1
        e[b] += 1
    for i in e.values():
        print(i)
    return

#C
def C():
    n, k = LI()
    d = [0] * (n+1)
    for i in range(1, n + 1): d[i] = 0
    for i in range(n):
        a, b = LI()
        d[a] += b
    for i in range(n+1):
        k -= d[i]
        if k <= 0:
            print(i)
            return
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


### FIXED CODE ###

N, K = map(int, input().split())
A = [0 for _ in range(10 ** 5)]
for i in range(N):
    a, b = map(int, input().split())
    A[a - 1] += b
for i in range(10 ** 5):
    if K - A[i] > 0:
        K = K - A[i]
    else:
        print(i + 1)
        break
n,x=[int(x) for x in input().rstrip().split()]
l=[int(x) for x in input().rstrip().rsplit()]

cnt=0
now=0
i=0
while(now<=x):
  cnt+=1
  now+=l[i]
  i+=1
print(cnt)

### FIXED CODE ###

n,x=[int(x) for x in input().rstrip().split()]
l=[int(x) for x in input().rstrip().rsplit()]
 
cnt=1
now=0
for i in l:
  now+=i
  if now<=x:
    cnt+=1    
  else:
    break  
print(cnt)
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)

if a[0]==1:
    if a[1]==1:
        print(0)
    else:
        print(1)
else:
    ans = 0
    for num in a:
        if a.count(num) >= 2:
            continue
        else:
            cands = [i for i in a if i<=num*(1/2)]
            for cand in cands:
                if num % cand == 0:
                    break
            else:
                ans+=1
    print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
M = max(a)
cands = [0]*M

ans = 0
for num in a:
    if cands[num-1] >= 2:
        continue
    for i in range(num, M+1, num):
        cands[i-1] += 1
        
for num in a:
    if cands[num-1]==1:
        ans+=1
print(ans)
a=int(input())
S=input()
if a%2 != 0:
  print("No")
else:
  b=0
  while	b<=a//2-1:
        S[b]==S[a//2+b]
        b=b+1
  if b==a//2:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

print(int(input())**2)
X,Y = map(int, input(),split())
XY = X + Y / 2
print(XY)


### FIXED CODE ###

X,Y = map(int, input().split())
XY = int(X + Y / 2)
print(XY)
from math import log
K=int(input())
N=K
def func(N):
    res=0
    while(N!=0):
        res+=N%10
        N//=10
    return res
ans=func(K)
if ans==1:
    print(ans)
    quit()
n=ceil(log(K,10))
MOD=10**(n)
K=K*(ceil((10**n)/K))
ans=min(ans,func(K))
used=[0]*N
K%=MOD
K*=10
while(True):
    K%=N
    if K==0:
        print(1)
        quit()
    ans=min(ans,func(K)+1)
    if used[K]:
        print(ans)
        quit()
    used[K]=1
    K*=10


### FIXED CODE ###

import heapq
K=int(input())
G=[[((i+1)%K,1)] for i in range(K)]
for i in range(K):
    a=(i*10)%K
    G[i].append((a,0))
def dijkstra(G,s):#Gはi->jの辺をG[i]=[(j,cost),...]で保存
  INF=10**19
  n=len(G)
  d=[INF]*n#n=node数
  d[s]=0
  visited={s}
  que=[(0,s)]
  while(que):
    p=heapq.heappop(que)
    v=p[1]
    visited.add(v)
    for node,cost in G[v]:
      if (node not in visited) and d[node]>d[v]+cost:
        d[node]=d[v]+cost
        heapq.heappush(que,(d[node],node))
  return d

d=dijkstra(G,1)
print(d[0]+1)
N=int(input())
for i in range 26:
  price=4*i
  for j in range 16:
    price+=7*j
    if price==N:
      print('Yes')
      break
print('No')


### FIXED CODE ###

N=int(input())
for i in range(26):
  price=4*i
  for j in range(16):
    price+=7*j
    if price==N:
      print('Yes')
      break
  if price==N:
      break
else:
  print('No')
c = [0]*(int(input())+1)
c[-1] = 3
ans = 1
for a in list(map(int, input().split())):
    ans = (ans * (cnts[a-1] - cnts[a]))%mod
    cnts[a] += 1
print(ans)


### FIXED CODE ###


from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
AA = inpl()

cnts = [0]*(N+1)
cnts[-1] = 3

ans = 1
for a in AA:
    ans *= (cnts[a-1] - cnts[a])
    ans %= mod
    cnts[a] += 1


print(ans)
#d-even relation
n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]

for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=(anslist[i-1]+j[1])
        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:

                    search(k[0])
                else:
                    return
                   
        else:
            return 

search(1)
for i in anslist:
    print(i%2)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass

        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])
search(2)
for i in anslist:
    print(i%2)
N, M= map(int, input().split())
a_list = sorted(map(int, input().split()), reverse = True)

# インデックスを分かりやすくするために先頭に0を追加
match_num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [- 10 ** 5] * (N + 1)
dp[0] = 0

# 桁数を調べる
for i in range(1, N+1):
    dp[i] = max([dp[i - match_num[a]] + 1 for a in a_list])

# 各桁に使う数字を調べる
ans = [""] * dp[N]
rest_match = N
for i in range(dp[N]):
    for a in a_list:
        if dp[rest_match - match_num[a]] == dp[N] - i - 1:
            rest_match -= match_num[a]
            ans[i] = str(a)
            break
print("".join(ans))


### FIXED CODE ###

N, M= map(int, input().split())
a_list = sorted(map(int, input().split()), reverse = True)

# インデックスを分かりやすくするために先頭に0を追加
match_num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

inf = 10 ** 5
dp = [-inf] * (N + 1)
dp[0] = 0

# 桁数を調べる
for i in range(1, N+1):
    dp[i] = max([dp[i - match_num[a]] + 1 for a in a_list if i - match_num[a] >= 0] + [-inf])

# 各桁に使う数字を調べる
ans = [""] * dp[N]
rest_match = N
for i in range(dp[N]):
    for a in a_list:
        index = rest_match - match_num[a]
        if index >= 0 and dp[index] == dp[N] - i - 1:
            rest_match -= match_num[a]
            ans[i] = str(a)
            break
print("".join(ans))
N = input()
a = list(map(int,input().split()))
cost_sum = 0
print_cost = 20000

for a_i in range(min(a), max(a)+1):
    for a_j in a:
        cost_sum += ((a_j - a_i) ** 2)
    if print_cost > cost_sum:
        print_cost = cost_sum

print(print_cost)


### FIXED CODE ###

N = int(input())
list_N = [ x for x in range(1, N+1) ]
print( sum(list_N) )
s=str(inputs())
tmp = s.replace('hi','')
if tmp=='':
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s=str(input())
tmp = s.replace('hi','')
if tmp=='':
  print('Yes')
else:
  print('No')
a, b = input().split(' ')

c = int(b) - int(a)

print(int(a) - (c - 1))


### FIXED CODE ###

n = input()

if int(n) < 1000:
    print('ABC')
else:
    print('ABD')
n = int(input())
arr = list(map(int, input().split()))

d = defaultdict(int)

for x in arr:
    d[x] += 1

ans = []
for i in range(1, max(arr)):
    ans.append(d[i - 1] + d[i] + d[i + 1])

print(max(ans))

### FIXED CODE ###

from collections import Counter

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

for i in range(N):
    a.append(a[i]+1)
    a.append(a[i]-1)

ans = Counter(a)

print(ans.most_common()[0][1])
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

k = 1
p = False
for i in range(n):
    if a[k-1] == 2:
        print(i+1)
        p = True
        break
    k = a[k-1]
if not p:
    print(-1)


### FIXED CODE ###

a,b,c = map(int,input().split())
for i in range(b):
    if i * a % b == c:
        print("YES")
        exit()
print("NO")
a,b,c=int(input())
x=np.where(c-(a-b)>0,c-(a-b),0)

print(x)

### FIXED CODE ###

a,b,c=map(int,input().split())

x=0
if c-(a-b)>0:
  x=c-(a-b)

print(x)
def main():
    _ = input()
    a_list = map(int, input().split())
    b_list = map(int, input().split())
    diffs = map(lambda a, b: b - a, a_list, b_list)
    total = 0
    count = 0
    for diff in diffs:
        if diff > 0:
            count += diff // 2
            total += diff % 2
        else:
            count += -diff
            total += diff
    if count <= total:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


### FIXED CODE ###

import itertools


def main():
    x, y = map(int, input().split())
    if x % y == 0:
        result = -1
    else:
        result = next(filter(lambda i: i % y != 0, map(lambda i: i * x, itertools.count(1))))
    print(result)


if __name__ == '__main__':
    main()
rows = int(input())
x = []
for i in range(rows):
    x.append(list(map(int, input().split())))
    
for i in range(len(x)):
  if x[i][0]==x[i][1]:
    if [i+1][0]==[i+1][1]:
      if [i+2][0]==[i+2][1]:
        print('Yes')
      else:
        print('No')
    else:
      print('No')
        
  else:
    print('No')
    

### FIXED CODE ###

def judge():
    cnt = 0  # 今何連続でゾロ目が出ているか記録しておきます
 
    for _ in range(N):
        x, y = map(int, input().split())
        if x == y:
            # ゾロ目ストリークが1増えました
            cnt += 1
        else:
            # ゾロ目ストリークが切れました
            cnt = 0
 
        if cnt == 3:
            # 3連続になった瞬間、return True していいです
            return True
    
    # ダメでした
    return False
 
N = int(input())
 
if judge():
    print("Yes")
else:
    print("No")
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
h = []
for i in range(x):
    if(i + 1>k) : break
    for j in range(y):
        if((i + 1)*(j + 1)j>k): break
        for l in range(z):
            if((i + 1)*(j + 1)*(l + 1)>k): break
            h.append(a[i] + b[j] +c[l])
h.sort(reverse = True)
for i in range(k):
    print(h[i])

### FIXED CODE ###

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
h = []
for i in range(x):
    for j in range(y):
        if(i*j>k): break
        for l in range(z):
            if(i*j*l>k): break
            h.append(a[i] + b[j] +c[l])
h.sort(reverse = True)
for i in range(k):
    print(h[i])
a,b=int(input().split())
print((a+b)%24)

### FIXED CODE ###

a,b=map(int,input().split())
print((a+b)%24)
N,A,B,C=map(int,input().split())
l=[int(input()) for i in range(N)]
inf=10**9
def dfs(d,a,b,c):
    if d==n:#合成完了
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf
    ret0=def(d+1,a,b,c)#l[d]を使わない
    ret1=def(d+1,a+l[d],b,c)+10#l[d]をAに
    ret2=def(d+1,a,b+l[d],c)+10#l[d]をBに
    ret3=def(d+1,a,b,c+l[d])+10#l[d]をCに
    return min(ret0,ret1,ret2,ret3)
print(def(0,0,0,0))

### FIXED CODE ###

N,A,B,C=map(int,input().split())
l=[int(input()) for i in range(N)]
inf=10**9
def dfs(d,a,b,c):
    if d==N:#合成完了
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf #無からは作れない#0に合成するのにmpは使わないので-30
    ret0=dfs(d+1,a,b,c)#l[d]を使わない
    ret1=dfs(d+1,a+l[d],b,c)+10#l[d]をAに
    ret2=dfs(d+1,a,b+l[d],c)+10#l[d]をBに
    ret3=dfs(d+1,a,b,c+l[d])+10#l[d]をCに
    ans=min(ret0,ret1,ret2,ret3)
    return ans
print(dfs(0,0,0,0))
n = int(input())
a = input().split(" ")

sum = 1
for i in range(n):
  sum = sum * int(a[i])

if sum > 1000000000000000000 :
  print(-1)
else:
  print(sum)

### FIXED CODE ###

n,k = input().split(" ")

r = int(n) * int(k)

print(r)
H,W = map(int,input().split()) 
A = [0]*H
M = 0
queue = []
for i in range(H):
  A[i] = input()
  for j in range(W):
    if A[i][j] == '#':
      queue.append([i,j,0])
while queue:
  i,j,cost = queue.pop(0)
  if i+1 < H and A[i+1][j] != '#':
    queue.append([i+1,j,cost+1])
    A[i+1][j] = '#'
  if i-1 >= 0 and A[i-1][j] != '#':
    queue.append([i-1,j,cost+1])
    A[i-1][j] = '#'
  if j+1 < W and A[i][j+1] != '#':
    queue.append([i,j+1,cost+1])
    A[i][j+1] = '#'
  if j-1 >= 0 and A[i][j-1] != '#':
    queue.append([i,j-1,cost+1])
    A[i][j-1] = '#'
print(M)

### FIXED CODE ###

from collections import deque

H,W = map(int,input().split()) 
A = [[0]*W for _ in range(H)]
M = 0
queue = deque()
for i in range(H):
  s = input()
  for j in range(W):
    if s[j]== '#':
      queue.append([i,j,0])
      A[i][j] = '#'
while queue:
  i,j,cost = queue.popleft()
  M=max(M,cost)
  if i+1 < H and A[i+1][j] != '#':
    queue.append([i+1,j,cost+1])
    A[i+1][j] = '#'
  if i-1 >= 0 and A[i-1][j] != '#':
    queue.append([i-1,j,cost+1])
    A[i-1][j] = '#'
  if j+1 < W and A[i][j+1] != '#':
    queue.append([i,j+1,cost+1])
    A[i][j+1] = '#'
  if j-1 >= 0 and A[i][j-1] != '#':
    queue.append([i,j-1,cost+1])
    A[i][j-1] = '#'
print(M)
n, m = map(int, input().split())
a = map(int, input().split())

abc = Counter(a).most_common()
for i in range(m):
    b, c = map(int, input().split())
    abc.append((c, b))

abc.sort(reverse=True)

ans = 0
count = n
for c, b in abc:
    rep = min(count, b)
    ans += c * rep
    count -= rep
print(ans)

### FIXED CODE ###

from collections import Counter

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

abc = Counter(a).most_common()
for i in range(m):
    b, c = map(int, input().split())
    abc.append((c, b))

abc.sort(reverse=True)

ans = 0
count = n
for c, b in abc:
    rep = min(count, b)
    ans += c * rep
    count -= rep
print(ans)
x, a, b = (int(i) for i in input().split())

if x+a-b > 1:
  print('delicious')
else if x+a-b == 0:
    print('safe')
else:
    print('dangerous')


### FIXED CODE ###

x, a, b = (int(i) for i in input().split())

if b-a>x:
    print('dangerous')
elif b-a>0:
    print('safe')
else:
    print('delicious')
import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def f(e1):
  tx,ty,sx,sy=e1
  x=[]
  st=[tx-sx,ty-sy]; rst=R(st)
  for e2 in WP:
    wx,wy,r=e2
    wt=[tx-wx,ty-wy]; rwt=R(wt)
    sw=[wx-sx,wy-sy]; rsw=R(sw)
    F=[rwt<r,rsw<r]
    if F==[1,0] or F==[0,1]: return 0
    elif F==[0,0]:
      a=M.pi/2-M.acos(r/rsw)
      b=M.acos(round((sw[0]*st[0]+sw[1]*st[1])/rsw/rst,4))
      if a+1e-6>b and rst**2+1e-6>rsw**2-r**2: return 0
  return 1

while 1:
  n=input()
  if n==0: break
  WP=I(n)
  P=I(input())
  for e in P: print ["Safe","Danger"][f(e)]

### FIXED CODE ###

n=input()
for _ in [0]*n:
  s=raw_input()
  A=s[0]
  for i in range(0,len(s),3):
    if s[i:i+3]==(A[-1]+"->"): A+=s[i+3]
    elif s[i:i+3]==(A[0]+"<-"): A=s[i+3]+A
  print "".join(A)
def check(X,Y):
    Hs = []
    for x,y,h in xyh:
        if h > 0:
            H = h + abs(X-x) + abs(Y-y)
            Hs.append(H)
        else:
            if abs(X-x) + abs(Y-y) < H:
                return False

    if len(set(Hs)) == 1:
        print(X,Y,Hs[0])
        return True
    else:
        return False

N = int(input())

xyh = [tuple(map(int,input().split())) for _ in range(N)]

for i in range(101):
    for j in range(101):
        if check(i,j):
            exit()

### FIXED CODE ###

N = int(input())

xyh = []
not_zero = -100
flag_zero = True

for i in range(N):
    x,y,h = map(int,input().split())
    if h > 0 and flag_zero:
        not_zero = i
        flag_zero = False
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):

        Cx = i
        Cy = j
        H = xyh[not_zero][2] + abs(Cx-xyh[not_zero][0]) + abs(Cy-xyh[not_zero][1])
        ans = True

        for x,y,h in xyh:
            tmp_h = h+abs(Cx-x)+abs(Cy-y)
            if h>0:
                if tmp_h != H:
                    ans = False
                    break
            else:
                if H - abs(Cx-x) -abs(Cy-y) > 0:
                    ans = False
                    break
            
        if ans:
            print(Cx,Cy,H)
            exit()
MOD = 10**9 + 7
INF = 10**20
I = lambda:list(map(int,input().split()))
from collections import defaultdict as dd
from math import gcd

s = input()
n = len(s)
ans = 0
for i in range(n//2):
    ans += (s[i] != s[n-i-1])
print(ans)

### FIXED CODE ###


MOD = 10**9 + 7
INF = 10**20
I = lambda:list(map(int,input().split()))
from collections import defaultdict as dd

s = input()
n = len(s)
ans = 0
for i in range(n//2):
    ans += (s[i] != s[n-i-1])
print(ans)
H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

sum = (H - h) * (W - w)
print sum
H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

sum = (H - h) * (W - w)
print sum


### FIXED CODE ###

H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

sum = (H - h) * (W - w)
print sum
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

result = 0

if M == 0:
    for i in range(math.floor((N-1)/2) + 1):
        result += cmb(N - List[M-1]-1-i,i) 
    result = result % 1000000007 
    print(result)

else:
    for i in range(math.floor((List[0]-1)/2) + 1):
        result += cmb(List[0]-1-i,i) 
            
    for i in range(M-1):
        if List[i+1] - List[i] == 1:
            result = 0
            break
        else:
            tmp = 0
            for j in range(math.floor((List[i+1]-List[i]-2)/2) + 1):
                tmp += cmb(List[i+1]-List[i]-2-j,j)
            result = result * tmp

    tmp = 0
    for i in range(math.floor((N - List[M-1]-1)/2) + 1):
        tmp += cmb(N - List[M-1]-1-i,i) 

    result = result * tmp
    result = result % 1000000007 
    print(result)
    
    

### FIXED CODE ###

N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
a.append(-1)

dp = [0 for i in range(N + 1)]
dp[0] = 1
point = 0
if a[point] == 1:
    dp[1] = 0
    point += 1
else:
    dp[1] = 1
for i in range(2, N + 1):
    if i == a[point]:
        dp[i] = 0
        point += 1
    else:
        dp[i] = (dp[i - 2] + dp[i - 1]) % (10 ** 9 + 7)
print(dp[N])
#!/usr/bin/env python3
import sys


def solve(S: int):

    S = str(S)

    if int(S[:2]) > 12 and 1 <= int(S[2:]) <= 12:
        print("YYMM")
    elif 1 <= int(S[:2]) <= 12 and int(S[2:]) > 12:
        print("MMYY")
    elif 1 <= int(S[:2]) <= 12 and 1 <= int(S[2:]) <= 12:
        print("AMBIGUOUS")
    else:
        print("NA")

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(S: int):

    if 1 <= int(S[2:]) <= 12:
        if 1 <= int(S[:2]) <= 12:
            print("AMBIGUOUS")
        else:
            print("YYMM")
    else:
        if 1 <= int(S[:2]) <= 12:
            print("MMYY")
        else:
            print("NA")

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    solve(S)


if __name__ == "__main__":
    main()
from collections import defaultdict
from heapq import heappop, heappush

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


class Graph(object):
    def __init__(self):
        self.edges = defaultdict(list)
        self.nodes = set()

    def add_edge(self, src, dst, weight=1):
        self.edges[src].append((dst, weight))
        self.nodes.add(src)
        self.nodes.add(dst)


def BellmanFord(graph, start):
    N = len(graph.nodes)
    dist = [float('-inf')] * N
    dist[start] = 0
    prev = [None] * N

    for _ in range(N - 1):
        for u, l in graph.edges.items():
            for v, weight in l:
                if dist[v] < dist[u] + weight:
                    dist[v] = dist[u] + weight
                    prev[v] = u
    
    for u, l in graph.edges.items():
        for v, weight in l:
             if dist[u] + weight > dist[v]:
                 return False
    return dist


g = Graph()
for _ in range(M):
    a, b, c = map(int, input().split())
    g.add_edge(a - 1, b - 1, c)

dist = BellmanFord(g, 0)
if dist:
    print(dist[N - 1])
else:
    print('inf')


### FIXED CODE ###

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


class BellmanFord(object):
    def __init__(self, edges, n_nodes, start):
        self.edges = edges
        dist = [float('inf')] * n_nodes
        dist[start] = 0
        prev = [None] * n_nodes

        for _ in range(n_nodes - 1):
            for u, v, weight in edges:
                if dist[u] == float('inf'):
                    continue
                if dist[v] > dist[u] + weight:
                    dist[v] = dist[u] + weight
                    prev[v] = u
        self.dist = dist
        self.prev = prev

    def check(self, goal=None):
        if goal is None:
            for u, v, weight in self.edges:
                if self.dist[v] > self.dist[u] + weight:
                    return False
            return True
        else:
            negative = [False] * N
            for _ in range(N):
                for u, v, weight in self.edges:
                    if self.dist[u] == float('inf'):
                        continue
                    if negative[u] or self.dist[v] > self.dist[u] + weight:
                        negative[v] = True
            return not negative[goal]


edges = [None] * M
for i in range(M):
    a, b, c = map(int, input().split())
    edges[i] = (a - 1, b - 1, -c)

bf = BellmanFord(edges, N, 0)
if bf.check(N - 1):
    print(-bf.dist[N - 1])
else:
    print('inf')
N = int(input())
while(N>0):
  if N%4 == 0:
    print("Yes")
    return
  else:
    N = N - 7
if N ==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
    if N%4 == 0:
      print('Yes')
      break
    else:
      N = N - 7
  else:
    print('No')