peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
ans=0
a,b=map(int,input().split())
while True:
  if a*2<=b:
    ans+=1
    a=a*2
  else:
    break
print(ans+1)
# Judge status: Accepted
n,d=map(int,input().split())
import math 
ans=math.ceil(n/(2*d+1))
print(ans)
# Judge status: Wrong Answer
A, B, C = map(str, input().split())

D = 0
E = 0

if A == 5:
    D += 1

if A == 7:
    E += 1

if B == 5:
    D += 1

if B == 7:
    E += 1

if C == 5:
    D += 1

if C == 7:
    E += 1

if D == 2 and E==1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted

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


if N % 2 == 0:
  latter = A[0:N:2]
  former = A[1:N:2][::-1]
  print(*(former + latter))
else:
  former = A[0:N:2][::-1]
  latter = A[1:N:2]
  print(*(former + latter))
# Judge status: Accepted
a = []
a = input().split()
N = int(a[0])
M = int(a[1])

if N == M:
  print('Yes')
else:
  print('No')


#print('N=', N, 'M=', M)
# Judge status: Accepted
n = int(input())
s = [input() for _ in range(n)]
al = []
lst = []
for i in s:
    for j in i:
        if not j in al:
            al.append(j)
al = sorted(al)

for i in al:
    num = float('inf')
    for j in s:
        num = min(num, j.count(i))
    lst.append(num)

result = [al[i] * lst[i] for i in range(len(al))]

print(''.join(result))
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
ans = 0 if b <= c else min(b, d) - max(a, c)
print(ans)
# Judge status: Wrong Answer
x = int(input())
y = int(x**0.5)
 
while x % y != 0:
  y -=1
  if x%y==0 and y==1:
    x +=1
    y = int(x**0.5)
  elif x%y==0 and y!=0:
    break
  else:
    continue
print(x)
# Judge status: Wrong Answer
n = int(input())
s = input()

r = []
g = []
b = []

for i,x in enumerate(s):
    if x == 'R':
        r.append(i+1)
    elif x == 'G':
        g.append(i+1)
    elif x == 'B':
        b.append(i+1)

ans = len(r)*len(g)*len(b)

for i in range(n):
    for j in range(i+1, n):
        k = 2*j-1
        if k<n and s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            ans -= 1

print(ans)
# Judge status: Accepted
# 2020/04/25
# CODE FESTIVAL 2016 Final - B

# Input
n = int(input())

# Calc
wk_val = 0

x = 1
# while (x*(x+1)) / 2 <= n:
while (x*(x+1)) / 2 < n:
    x = x + 1

wk_ans = 0
anslist = list()
while(x > 0):
    if wk_ans + x <= n:
        wk_ans = wk_ans + x
        anslist.append(x)

    if wk_ans == n:
        break
    
    x = x - 1

# Output
for i in range(len(anslist)):
    print(anslist[i])
# Judge status: Accepted
l = int(input())
print((l / 3) * (l / 3) * (l / 3))
# Judge status: Accepted
N, K = (int(i) for i in input().split())  
P = list(map(int, input().split()))

P.sort()

print(sum(P[:K]))
# Judge status: Accepted
N = int(input())
for X in [-int(-N/1.08), int((N+1)/1.08)]:
    if int(X * 1.08) == N:
        print(X)
        exit()
print(":(")
# Judge status: Accepted
import numpy as np

n = int(input())
S = [list(input()) for i in range(n)]

alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
aa = [[0]*len(alpha) for i in range(n)]

for i in range(n):
    for j in S[i]:
        a = alpha.index(j)
        aa[i][a] += 1

ans = []

aa = np.array(aa)

for i in range(len(alpha)):
    x = min(aa[:,i])
    ans.append(x)

ans2 =[]
for i in range(len(alpha)):
    ans2.append(alpha[i]*ans[i])

print("".join(ans2))
# Judge status: Accepted
N,K = map(int, input().split())
A = [*map(lambda x:int(x)-1, input().split())]

cnt, pre = [0]*N, 0
for _ in range(N*2):
    cnt[pre] += 1
    pre = A[pre]

one, loops = 0, 0
for c in cnt:
    if c == 1: one += 1
    elif c > 1: loops += 1

k = max(0, K-one) % loops + min(K, one)

pre = 0
for _ in range(k): pre = A[pre]
print(pre + 1)
# Judge status: Wrong Answer
a,b = map(str,input().split())
c = int(a+b)
#print(float(c))
import math
#print(math.sqrt(c))
if float(c) == math.sqrt(c)**2:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import sys
import numpy as np
import itertools

from collections import deque 
from functools import reduce

# input = sys.stdin.readline

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

a = [list(map(int, input().split()))]

a_np = np.array(a)
a_np = a_np.flatten()
a_np = np.hstack((a_np, k))
a_sa = abs(a_np[:-1] - a_np[1:])
print(a_sa.sum() - a_sa.max())
# Judge status: Accepted

n = int(input())

s = [input() for _ in range(n)]
ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
	if s[i] == 'AC':
		ac += 1
	elif s[i] == 'WA':
		wa += 1
	elif s[i] == 'TLE':
		tle += 1
	elif s[i] == 'RE':
		re += 1

print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))
# Judge status: Wrong Answer
s=input()
for i in range(len(s)):
  t="x"
print(t)
# Judge status: Wrong Answer
import sys


def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))


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


#############
# Main Code #
#############
a = getN()
b = getN()
h = getN()
print((a + b) // 2 * h)
# Judge status: Accepted
def main():
    N = int(input())
    A = [int(a) for a in input().split()]

    cost = 10**10

    for a in range(-200, 201):
        c = 0
        for i in range(N):
            c += (a - A[i])**2
        if c < cost:
            cost = c
    print(cost)
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append((a,b))
l.sort(key=lambda x:x[1])
tmp=0
for i in range(n):
    tmp+=l[i][0]
    if tmp>l[i][1]:
        print("NO")
        exit()
print("YES")
# Judge status: Wrong Answer
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------

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

Ans = []
for i in range(N):
    ans = 0
    for j in range(i,N-1):
        c,s,f = CSF[j]
        if ans < s:
            ans = s
        ans += ans % f
        ans += c
    Ans.append(ans)

for ans in Ans:
    print(ans)
# Judge status: Accepted
import math
N = int(input())

sum = math.floor((N * (1 + N))/2)

print(sum)
# Judge status: Accepted
n=int(input())
k=int(input())
x=int(input())
y=int(input())

if n<=k:
  print(n*x)
else:
  print(k*x+(n-k)*y)
# Judge status: Wrong Answer
S = str(input())
temp = len(S)
if S == S[::-1]:
    tempi =S[0:(temp-1)//2]
    #print(tempi)
    if tempi == tempi[::-1]:
        tempi2 = S[(temp+3)//2+1:]
        #print(tempi2)
        if tempi2 == tempi2[::-1]:
            print('Yes', end='')
        else:
            print('No', end='')
    else:
        print('No', end='')
else:
    print('No', end='')
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
ans=[]
for i in range(0,n-k+1):
  l=x[i]
  r=x[i+k-1]
  ans.append(min(abs(l)+abs(l-r),abs(r)+abs(l-r)))
print(min(ans))
# Judge status: Accepted
N, M = map(int, input().split())
ans = 0

if 2 * N == M:
    ans = N
elif 2 * N > M:
    ans = M // 2
else:
    ans += N
    M -= 2*N
    ans += M // 4

print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
Y = [X[i] - X[i-1] for i in range(1, M)]
Y.sort(reverse=True)
Y = Y[N-1:]
print(sum(Y))
# Judge status: Accepted
def main():
    H,N = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    maxA = max(A for A,B in AB)
    dp = [0]*(H+maxA)
    dp[0] = 0
    for i in range(1,H+maxA):
        dp[i] = min(dp[i-A]+B for A,B in AB)
    print(min(dp[H:]))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>=b:
  print("b"*a)
else:
  print("a"*b)
# Judge status: Wrong Answer
from collections import Counter


S = input()
C = Counter(S)
print(C)
vs = sorted(list(C.values()))
if len(vs) == 1:
    print("YES") if vs[0] == 1 else print("NO")
elif len(vs) == 2:
    print("YES") if vs[0] == vs[1] and vs[0] == 1 else print("NO")
else:
    print("YES") if vs[2] - 1 <= vs[0] and vs[2] - 1 <= vs[1] else print("NO")
# Judge status: Accepted
# -*- coding: utf-8 -*-
n = int(input())
my_list = list(map(int, input().split()))

my_set = set()

for item in my_list:
    if item in my_set:
        print('NO')
        exit()
    else:
        my_set.add(item)

print('YES')
# Judge status: Accepted
a, b = map(int, input().split())

def shouhi(n,a,b):
    if (int(n * 1.08) -n == a) & (int(n * 1.1) -n== b):
        return True
    return False
ou = False
for n in range(int(a / 0.08), int(a / 0.08) + 13):
    if shouhi(n,a,b):
        print(n)
        ou = True
        break
if not ou:
    print(-1)
# Judge status: Accepted
N= int(input())
if N<=9:
    print(N)
elif 10<= N <=99:
    print('9')
elif 100<= N <=999:
    print(N-90)
elif 1000<= N <=9999:
    print('909')
elif 10000<= N<= 99999:
    print(N-9090)
else:print(90909)
# Judge status: Accepted
X = int(input())
sum  = 0
for i in range(1,X+1):
    if i%3==0 and i%5==0:
        continue
    elif i%3==0:
        continue
    elif i%5==0:
        continue
    else:
        sum = sum + i

print(sum)
# Judge status: Accepted
N,K = map(int,input().split())
print(1) if N%K else print(0)
# Judge status: Wrong Answer
a = int(input())

if a % 2 == 0:
  num = a / 2
else:
  num = (a + 1) / 2

print(num)
# Judge status: Accepted
string=input()
a=len(string)

if string[a-1]=='s':
    print(string+'es')
else:
    print(string+'s')
# Judge status: Wrong Answer
s = input()
cnt = 0
if s[0] != 'A':
    print('WA')
elif s[2:-1].count('C') != 1:
    print('WA')
elif s[1:3].islower() != True and s[-1].islower !=  True:
    print('WA')
else:
    print('AC')
# Judge status: Wrong Answer
# 初期入力
N,W = (int(x) for x in input().split())
W_V = [list(map(int, input().split())) for i in range(N)]

#価値でソート
W_V_sorted = sorted(W_V,key=lambda x:x[1],reverse=True)

#ナップザックに入れる
v_sum = 0
w_sum = 0
for w_v in W_V_sorted:
    if w_sum + w_v[0] <= W: # 入れても重量内なら
        v_sum += w_v[1]
        w_sum += w_v[0]  


print(v_sum)
# Judge status: Wrong Answer
import sys
S = input()
def is_palindrome(S):
  P = S[::-1]
  print(P)
  if S == P:
    return True
  return False
if is_palindrome(S):
  N = len(S)
  if is_palindrome(S[0:(N-1)//2]) and is_palindrome(S[(N+3)//2-1:N]):
    print('Yes')
    sys.exit(0)
print('No')
# Judge status: Accepted
from collections import deque

def main():
    S = input()
    count = 0
    d = deque(list(S))
    while len(d) > 1:
        left = d.popleft()
        right = d.pop()
        if left != right:
            count += 1

    print(count)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split())) 

half = sum(a)/2
l, r, i = 0, a[0], 0

while r < half:
    i += 1
    l = r
    r += a[i]

print(int(min(half - l, r - half)*2 ))
# Judge status: Accepted
a, b, c = map(int, input().split())
print(max(0, c-a+b))
# Judge status: Wrong Answer
s = int(input())
ans = 1
while s!=1:
    ans += 1
    if s%2==0:
        s = s/2
    else:
        s = 3*s+1
print(ans+1)
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K % 2 == 0:
  print(A - B)
else:
  print(B - A)
# Judge status: Wrong Answer
from itertools import product

s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

ops = product([1,-1],repeat=3)

for op in ops:
  test = a + b * op[0] + c * op[1] + d * op[2]
  if test == 7:
    _op = [""]*3
    for i in range(3):
      _op[i] = "+" if op[i] else "-"
    print("{}{}{}{}{}{}{}=7".format(a,_op[0],b,_op[1],c,_op[2],d))
    exit()
print(-1)
# Judge status: Accepted
def main():
    S = input()
    T = input()
    d = dict()
    for s, t in zip(S, T):
        if s not in d.keys():
            if t in d.values():
                print('No')
                return
            d[s] = t
        else:
            if d[s] != t:
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, L = map(int, input().split())

if L <= 0 <= L+N-1:
  a = L
  b = L+N-1
elif 0 < L:
  a = L+1
  b = L+N-1
else:
  a = L
  b = L+N-2

ans = 0
for i in range(a, b+1):
  ans += i
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
s=max(a,b,c)
m=3*s-(a+b+c)
if m%2:print(m//2+2)
else:print(m//2)
# Judge status: Accepted
n, d = [int(x) for x in input().split()]

temp_list = []
for _ in range(n):
    x_list = [int(x) for x in input().split()]
    temp_list.append(x_list)

ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        dist = sum([(y - z) ** 2 for y, z in zip(temp_list[i], temp_list[j])]) ** 0.5
        if int(dist) == dist:
            ans += 1
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)

#必要票数を求める
s = sum(a)
needed = s/4/m if s%(4*m) == 0 else s//(4*m)+1

for i in range(m):
    if a[i] < needed:
        print("No")
        break
else:
    print("Yes")
# Judge status: Wrong Answer
N = int(input())

if 999 >= N >= 100:
    print("ABC"  + str(N))
if 99 >= N >= 10:
    print("ABC0" + str(N))
if 9 >= N >= 1:
    print("ABC00" + str(N))
if 1008 >= N >= 1000:
    M = N - 999
    print("ABD00" + str(M))
if 1098 >= N >= 1009:
    M = N - 999
    print("ABD00" + str(M))
if 1998 >= N >= 1099:
    M = N - 999
    print("ABD00" + str(M))
# Judge status: Wrong Answer
S = list(map(str,input()))

odd = ['R','U','D']
even = ['L','U','D']

for i in range(len(S)):
    if (i+1) == 0:
        if S[i] in odd:
            print('No')
            exit()
    elif (i+1) == 1:
        if S[i] in even:
            print('No')
            exit()
print('Yes')
# Judge status: Accepted
N,M =input().split()

N = int(N)

M = int(M)

if N == M:
    print ("Yes")
    
else:
    print ("No")
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from fractions import gcd
from functools import reduce

N,*A = map(int,read().split())

MOD = 10 ** 9 + 7

lcm = 1
answer = 0
for x in A:
  n = x//gcd(lcm,x)
  lcm *= n
  answer *= n
  answer += lcm//x
  
answer %= MOD
print(answer)
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()

B = []
for i in range(M-1):
  B.append(abs(A[i+1]-A[i]))
B.sort()
#print(A)
#print(B)   

if N >=M:
  ans = 0
else:
  ans = sum(B[:-(N-1)])
print(ans)
           
#dp[i][j]: i個目までにj
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if (abs(a-b) <= d and abs(b-c) <= d) or abs(a-c) <= d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, K = [int(s) for s in input().split(" ")]
res = 0
for i in range(K, N + 2):
  res += (N - i + 1) * i + 1
  #print res, i, (N - i + 1) * i + 1
print(res % 1000000007)
# Judge status: Wrong Answer
s = input()

y = int(s[0:4])
m = int(s[5:7])
d = int(s[8:12])

if(m <= 4 and d <=30):
  print("Heisei")
else:
  print("TBL")
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
sc=Counter(list(map(int,input().split())))
sm=0
for k,v in sc.items():
  sm+=min(abs(k-v),v) 
print(sm)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    x,y=map(int,input().split())
    ans=10**20
    if -x<=-y:
        ans=min(ans,2+-y-(-x))
    if -x<=y:
        ans=min(ans,1+y-(-x))
    if x<=-y:
        ans=min(ans,1+(-y)-x)
    if x<=y:
        ans=min(ans,y-x)
    print(ans)

resolve()
# Judge status: Accepted
n,k = (int(a) for a in input().split())
h = sorted(list(map(int, input().split())))
if n <= k :
    print(0)
else :
    print(sum(h[:(n-k)]))
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
A = []
for P in range(1,max(X)+1):
    for i in range(N):
        A.append((X[i]-P)**2)
    if sum(A[0:N]) <= sum(A[N:2*N]) or len(A) == N:
        A = A[0:N]
    else:
        A = A[N:2*N]
print(sum(A))
# Judge status: Accepted
n=int(input())
min_sum=1000000

for a in range(1,n):
  l_a=str(a)
  l_b=str(n-a)
  
  sum_a=0
  sum_b=0
  for e_a in l_a:
    sum_a+=int(e_a)
  for e_b in l_b:
    sum_b+=int(e_b)
  sum_ab = sum_a+sum_b
  
  if sum_ab<min_sum:
    min_sum=sum_ab
    
print(min_sum)
# Judge status: Accepted
x,a,b = map(int,input().rstrip().split(" "))
if abs(x-a) < abs(x-b):
    print("A")
else:
    print("B")
# Judge status: Accepted
C = [list(map(int, input().split())) for _ in range(3)]
flag = True
for i in range(2):
    if C[i+1][0]-C[i][0] == C[i+1][1]-C[i][1] and C[i+1][0]-C[i][0] ==  C[i+1][2]-C[i][2]:
        pass
    else:
        flag = False

for i in range(2):
    if C[0][i+1]-C[0][i] == C[1][i+1]-C[1][i] and C[0][i+1]-C[0][i] ==  C[2][i+1]-C[2][i]:
        pass
    else:
        flag = False

if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
D = input()
if D == 25:
    print "Christmas"
if D == 24:
    print "Christmas Eve"
if D == 23:
    print "Christmas Eve Eve"
if D == 22:
    print "Christmas Eve Eve Eve"
# Judge status: Accepted
s=input()
a_min=0
z_max=0
for i in range(len(s)):
  if s[i]=="A":
    a_min=i
    break
for i in range(len(s)):
  if s[i]=="Z":
    z_max=i
print(z_max-a_min+1)
# Judge status: Accepted
m,n=map(int,input().split())
l=list(map(int,input().split()))
if len(l)==m:
  l.sort()
  if n<=m:
    for i in range(n):
      l.pop()
    print(sum(l))
  else:
    print(0)
else:
  print(0)
# Judge status: Accepted
# coding: utf-8

def main():
    a, b, c = map(int, input().split())
    ans = 0

    if a == b and b == c and a % 2 == 0:
        ans = -1
    else:
        while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
            d = b / 2 + c / 2
            e = c / 2 + a / 2
            f = a / 2 + b / 2
            a, b, c = d, e, f
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import sys
n = int(input())
ans = ""
if n == 1:
    print("a")
    sys.exit(0)
else:
    c = 2 ** (n-1)
    for i in range(c):
        tmp = "a"
        for j in range(n-1):
            if i >> j & 1:
                tmp += "b"
            else:
                tmp += "a"
        print(tmp)
# Judge status: Wrong Answer
n, l = list(map(int, input().split()))

c = 0

if l > 0:
    c = ((l+1) + (l+n-1)) * (n-1) // 2
elif l <= 0 <= l + n - 1:
    c = ((l) + (l+n-1)) * (n-1) // 2
else:
    c = ((l) + (l+n-2)) * (n-1) // 2

print(c)
# Judge status: Accepted
n,p=map(int,input().split())
a,s=1,0
for i in list(map(int,input().split())):
    if i%2:
        a,s=a+s,a+s
    else:
        a,s=2*a,s*2
print((a,s)[p])
# Judge status: Accepted
n = int(input())
s = input()
ans=0
for stone in s:
    if stone==".":
        ans+=1
ans_mn=ans
for i in range(len(s)):
    if s[i]=="#":
        ans+=1
    if s[i]==".":
        ans-=1
    if ans < ans_mn:
        ans_mn=ans
print(ans_mn)
# Judge status: Accepted
n, k = map(int, input().split())
l = [0] * (10000001)
for _ in range(n):
	a, b = map(int, input().split())
	l[a] += b
for i in range(1, 10000001):
	if k <= l[i]:
		print(i)
		break
	k -= l[i]
# Judge status: Accepted
n = int(input())

for i in range(1, 10):
    for j in range(1, 10):
        if n == i * j:
            print("Yes")
            exit()

print("No")
# Judge status: Accepted


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

def main():
  for i in reversed(range(n-1)):
    if h[i] - h[i+1] > 1:
      return False
      exit()
    elif h[i] - h[i+1] == 1:
      h[i] -= 1
    else:
      continue
  return True

if main() == True:
  print('Yes')

else:
  print('No')
# Judge status: Accepted
a = int(input())
s = input()
print(s if a >= 3200 else "red")
# Judge status: Wrong Answer
k = int(input())
a, b = map(int, input().split())
print('OK' if b - a + 1 >= k else 'NG')
# Judge status: Accepted
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

import math

s = ii()

a = 0

for n in range(0, s//3):
 k = s - 3*(n+1) + n
 a += math.factorial(k)//math.factorial(k-n)//math.factorial(n)

print(a%1000000007)
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	x=II()

	a=0

	for i in range(100000):
		a+=x
		if a%360==0:
			print(i+1)
			exit(0)





if __name__ == "__main__":
	main()
# Judge status: Accepted
n=int(input())
x=0
z=0
for i in range(n):
  t=int(input())
  if t:
    x+=t
  else:
    z+=x//2
    x=0
print(z+x//2)
# Judge status: Accepted
_,*a=map(int,open(0).read().split());x=1000
for i,j in zip(a,a[1:]):x+=x//i*(j-i)*(j>i)
print(x)
# Judge status: Accepted
N = int(input())
AList = list(map(int, input().split()))

sortList = sorted(AList)
Amax = max(sortList)
dp = [0] * (Amax+1)

for n in sortList:
  dp[n] += 1
  if dp[n] == 1:
    for j in range(n*2, Amax+1, n):
      dp[j] += 2
print(dp.count(1))
# Judge status: Accepted
N,P=map(int,input().split())
A=list(map(int,input().split()))
a=0
for i in A:
  if i%2==0:
    a+=1
b=N-a
c=0
import math
def comb(n,r):
  return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))  
for i in range(b//2+1):
  c+=comb(b,2*i)
if P==0:
  print((2**a)*c)
else:
  print(2**N-(2**a)*c)
# Judge status: Accepted
n, k = map(int, input().split())

m_1 = n % k
m_2 = k - m_1
print(min(m_1, m_2))
# Judge status: Accepted
a, b, k = map(int, input().split())
kcd = 0
for i in range(min(a + 1, b + 1), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
    if k == 0:
        kcd = i
        break
print(kcd)
# Judge status: Accepted
#n, m = list(map(int,input().split()))

s = input()
f = True

if s[::-1] != s:
    f = False

t = s[:(len(s)-1)//2]
if t != t[::-1]:
    f = False

t = s[(len(s)+3) // 2 - 1:]
if t != t[::-1]:
    f = False

if f:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b = input().split()
A, B = a*int(b), b*int(a)
print(min(A, B))
# Judge status: Wrong Answer
n, k, s = map(int, input().split()) 
su = []
for i in range(n):
  su.append(s)

for i in range(n-k):
  su[i] = s+1

print(*su)
# Judge status: Wrong Answer
def find_gcd(x, y): 
    while(y): 
        x, y = y, x % y 
  
    return x 

l = [2, 4, 6, 8, 16] 
  
num1=l[0] 
num2=l[1] 
gcd=find_gcd(num1,num2) 
  
for i in range(2,len(l)): 
    gcd=find_gcd(gcd,l[i]) 
      
print(gcd)
# Judge status: Wrong Answer
import math
n = int(input())
mn = float("inf")
for i in range(5):
  ai = int(input())
  if mn > ai:
    mn = ai
print(4+math.ceil(mn//n))
# Judge status: Wrong Answer
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
D = list(map(int, input().split()))
D.sort()
for k in range(max(D)):
    arc = 0
    abc = 0
    for i in range(n):
        if D[i] >= k:
            arc += 1
        else:
            abc += 1
    if arc == abc:
        count += 1
print(count)
# Judge status: Accepted
import sys
import math


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


def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    time =0

    m =min(A,B,C,D,E)
    time +=math.ceil(N/m) +4
    print(time)







if __name__ == "__main__":
    main()
# Judge status: Accepted
def main():
    S = list(input())
    S.sort()
    if S == ['a', 'b', 'c']:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()