peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a,b,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = min(A)+min(B)
for _ in range(m):
    x,y,c = map(int,input().split())
    ans = min(ans,A[x-1]+B[y-1]-c)
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
x=n%k
print(min(x,k-x))
# Judge status: Wrong Answer
N,D=map(int, input().split())
print(100**D*N)
# Judge status: Wrong Answer
s = input()
t = input()

go = []
back = []
g = []
b = []
def has_duplicates(seq):
    return len(seq) != len(set(seq))


for i in range(len(s)):
  go.append(s[i]+t[i])
  back.append(t[i]+s[i])

go_l = set(go)
back_l = set(back)
go = list(go_l)
back = list(back_l)

print(go)
print(back)

for i in range(len(go)):
  g.append(go[i][0])
  b.append(back[i][0])
  
print(g)
print(b)
  
ansg = has_duplicates(g)
ansb = has_duplicates(b)

if ansg == True or ansb == True:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
n, k, *a = map(int, open(0).read().split())
a.sort()
for i in range(n-1): a[n-i-1] = abs(a[n-i-1]-a[n-i-2])
a[0] = 0
for i in range(n-1): a[i+1] += a[i]

mn = 1e18
for i in range(n-k+1): mn = min(mn, a[i+k-1]-a[i])
print(mn)
# Judge status: Wrong Answer
a, b = [int(x) for x in input().split()]

print("Possible" if (a + b) % 3 == 0 else "Impossible")
# Judge status: Accepted
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()

if n >= m:
    print(0)
    exit()
sub = [0]*(m-1)
for i in range(m-1):
    sub[i] = x[i+1]-x[i]
sub.sort()

ass = 0
for i in range(m-n):
    ass += sub[i]
print(ass)
# Judge status: Accepted
icase=0
if icase==0:
    bpmax=0
    x=int(input())
    for b in range(1,32):
        for p in range(2,10):
            bp=b**p
            if bp<=x:
                bpmax=max(bpmax,bp)
            else:
                break
    print(bpmax)
# Judge status: Accepted
#!/usr/bin/env python

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

ans = 0 
cc = m//2
if n >= cc: 
    ans = cc
else:
    ans = (n+cc)//2
print(ans)
# Judge status: Wrong Answer
s = input()
t = input()
ans = len(t)

for num in range(len(t)):
  if (t[:len(t) - num] in s):
    ans = num
    break
print(num)
# Judge status: Accepted
x,k,d = map(int,input().split())
x = abs(x)
i = int(x / d)
if k < i:
  print(x - k * d)
  exit()
if (k - i) % 2 == 0:
  print(x - i * d)
  exit()
print(abs(x - (i + 1) * d))
# Judge status: Accepted
w = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
S = input()
res = abs(w.index("SUN") - w.index(S))
if res == 0:
    res = 7
print(res)
# Judge status: Accepted
import sys
read_=sys.stdin.buffer.readline

N=int(read_())
ans_d={}
ans=0
for i in range(N):
    s=''.join(sorted(input()))
    if s in ans_d:
        ans+=ans_d[s]
        ans_d[s]+=1
    else:
        ans_d[s]=1

print(ans)
# Judge status: Wrong Answer
H_1, M_1, H_2, M_2, K = map(int, input().split())

time =(H_2 * 60 + M_2)-(H_1 * 60 + M_1)

a = time // K

if a == 0 :
    print(0)
    exit(0)

if time % K == 0:
    a = a-1

print(a*K)
# Judge status: Accepted
a, b = map(int, input().split())
if a <=5:
  print(0)
elif a<= 12:
  print(b//2)
else:
  print(b)
# Judge status: Accepted
from bisect import bisect_left as bt
n,m = map(int,input().split())
dm,ct = [[] for _ in range(n+1)],[]
for _ in range(m):
  a,b = map(int,input().split())
  dm[a].append(b); ct.append((a,b))
for i in range(1,n+1):
  dm[i].sort()
for c in ct:
  v,f = str(c[0]),str(bt(dm[c[0]],c[1])+1)
  print('0'*(6-len(v))+v+'0'*(6-len(f))+f)
# Judge status: Accepted
S = input()
c0 = S.count("0")
c1 = S.count("1")
ans = min(c0, c1) * 2
print(ans)
# Judge status: Accepted
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

#参加者のポイント
p = [k - q] * n
for i in a:
    p[i - 1] += 1

for i in p:
    if i > 0:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
n = int(input())
d = {}
for _ in range(n):
    s = input()
    if s not in d.keys():
        d[s] = 0
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    if s in d.keys():
        d[s] -= 1
d = sorted(d.items(), key=lambda x:x[1])
if d[-1][1] == - (m - 1): print(0)
else: print(d[-1][1])
# Judge status: Wrong Answer
from fractions import gcd
A, B, C, D = map(int, input().split())

U = B - A + 1
U_c = U // C
U_d = U // D
U_cd = U // (C * D // gcd(C, D))

ans = U - (U_c + U_d - U_cd)
if A % 4 == 0 or B % 4 == 0:
    ans -= 1
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for i in range(n)]
for i in range(1, n):
    m = 10**10
    index = i-1
    num = k
    while index >= 0 and num:
        m = min(m, dp[index]+abs(h[index]-h[i]))
        index-=1
        num-=1
    dp[i] = m
print(dp[n-1])
# Judge status: Accepted
A, B, K = map(int, input().split())

hoge = [A + i for i in range(K) if A + i <= B]
huga = [B - i for i in range(K) if A <= B - i]
for x in sorted(set(hoge+huga)):
    print(x)
# Judge status: Accepted
N = int(input())

ans = [0] * (N+1)

for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            try:
                ans[(x+y+z)**2 - (x*y+y*z+z*x)] += 1
            except:
                pass

for i in range(1, N+1):
    print(ans[i])
# Judge status: Wrong Answer
h,w = map(int,input().split())
if (w < 3 and h < 3):
    print(0)
else:
    print(max(1,h-2)*max(1,w-2))
# Judge status: Accepted
a,b,c = map(int, input().split())
k = int(input())

n = max(a, b)
n = max(n, c)

ans = a+b+c+n*(2**k-1)

print(ans)
# Judge status: Accepted
n = int(input())
s = str(input())
ans = 0
for i in range(1, n):
    x = set(s[0:i])
    y = set(s[i:])
    ans = max(ans, len(x & y))
print(ans)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M = map(int, readline().split())

    if N > M:
        N, M = M, N

    if M == 1:
        ans = 1
    elif N == 1:
        ans = M - 2
    else:
        ans = (N - 2) * (M - 2)

    print(ans)
    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
B=[]

if N>=M:
    print(0)
else:
    for i in range(M-1):
        B.append(X[i+1]-X[i])

    B.sort()
    print(sum(B[:M-N]))
# Judge status: Accepted
N=int(input())
a=N//100
b=(N-a*100)//10
c=N-a*100-b*10
if a<b:
    N=(a+1)*111
elif a>b:
    N=a*111
elif a==b and a>=c :
    N=a*111
elif a==b and a<c :
    N=(a+1)*111
print(N)
# Judge status: Wrong Answer
n, r= map(int, input().split())
ans = 0
if n < 10: ans = 100 * (10 - n)
else: ans = r
print(ans)
# Judge status: Wrong Answer
N, M = [int(i) for i in input().strip().split()]
A = [int(i) for i in input().strip().split()]
B = [0] * M
C = [0] * M
for i in range(M):
    B[i], C[i] = [int(i) for i in input().strip().split()]

for i in range(M):
    A.sort()
    for j in range(B[i]-1, 0, -1):
        if A[j] < C[i]:
            for k in range(j+1):
                A[k] = C[i]
print(sum(A))
# Judge status: Accepted
from math import ceil
temp_list = [int(input()) for _ in range(6)]
n = temp_list.pop(0)
print(4 + ceil(n / min(temp_list)))
# Judge status: Wrong Answer
import numpy as np
N=int(input())
S=str(input())
s_list = "abcdefghijklmnopqrstuvwxyz"
count_list = np.zeros(26)
max_count = 0
for i in range(N-1): # N字目で切った場合
  for k in range(i):
    if S[k] in S[i:len(S)-1]:
      count_list[s_list.index(S[k])] = count_list[s_list.index(S[k])] + 1
  if max_count < len([1 for x in count_list if x>0]):
    max_count = len([1 for x in count_list if x>0])
print(max_count)
# Judge status: Wrong Answer
S = input()
List = list(S)
ans = 1
h = 0

for i in range(len(List)):
  a = List[i]
  if a == "h":
    h = 1
  elif h == 1 and a == "i":
    h = 0
  else:
    ans = 0

if ans == 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, m, x = map(int, input().split())
lst = []
for i in range(n):
  lst.append(list(map(int, input().split())))
pmin = 10 ** 10
for i in range(1, 2 ** n): # 選び方
  sbin = format(i, 'b')
  sbin = '0' * (n - len(sbin)) + sbin
  temp = [0] * m
  p = 0
  for j in range(n): # 選ぶ行
    if sbin[j] == '1':
      for k in range(m): # 足す
        temp[k] += lst[j][k + 1]
      p += lst[j][0]
  if min(temp) >= x:
    pmin = min(pmin, p)
if pmin == 10 ** 10:
  print(-1)
else:
  print(pmin)
# Judge status: Accepted
X=int(input())
if X<30:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
x,y,z = map(int,input().split())

t = y+z
print(int((x-1)/t))
# Judge status: Accepted
A, B, C = map(int, input().split(' '))
K = int(input())

while K > 0:
    if B > A:
        break
    B *= 2
    K -= 1

while K > 0:
    if C > B:
        break
    C *= 2
    K -= 1

if A < B < C:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n,cap=map(int,input().split())
weigh=[]
profit=[]
temp=n
while temp!=0:
    w,p=map(int,input().split())
    weigh.append(w)
    profit.append(p)
    temp-=1

mat=[[0 for i in range(cap+1)] for j in range(n+1)]

for i in range(1,n+1):
    for j in range(1,cap+1):
        if j<weigh[i-1]:
            mat[i][j]=mat[i-1][j]
        else:
            mat[i][j]=max(profit[i-1]+mat[i-1][j-weigh[i-1]],mat[i-1][j])
print(mat[n][cap])
# Judge status: Wrong Answer
s= str(input())
ans = 0
for i in range(len(s)):
    if i // 2 == 0:
        if s[i] == '0':
            ans += 1
    else:
        if s[i] == '1':
            ans += 1
print(min (ans,len(s)-ans))
# Judge status: Accepted
import collections

N = int(input())
S = list(input() for _ in range(N))

setS = set(S)

print(len(setS))
# Judge status: Accepted
S = input()
hantei = True

for i in range(0,len(S)-1,2):
  if S[i]+S[i+1] != 'hi':
    hantei = False
if len(S) % 2 == 1:
  hantei = False
    
if hantei == True:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
S=input()
for i,s in enumerate(S):
    if s=='A':
        a=i
        break
for i,s in enumerate(S[::-1]):
    if s=='Z':
        z=i
        break
print((len(S)-z-a))
# Judge status: Accepted
a,_,_,_,e = [int(input()) for _ in range(5)]
k = int(input())

if e-a <= k:
    print("Yay!")
else:
    print(":(")
# Judge status: Accepted
N = int(input())
B = list(map(int,input().split()))
A = [1000000]*N
A[0] = B[0]
A[N-1] = B[N-2]
for i in range(1,N-1):
  A[i] = min(B[i],B[i-1])
print(sum(A))
# Judge status: Wrong Answer
def gcd(x,y,z):
  p=[x,y,z]
  p.sort()
  a=p[0]
  b=p[1]
  while a!=0 and b!=0:
    b-=a
    if a>b:
      c=b
      b=a
      a=c
  ee=[a,b]
  ee.sort()
  if p[2]%ee[1]==0:
    return(ee[1])
  else:
    return(1)
n=int(input())
s=0
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      s+=gcd(i,j,k)
print(s)
# Judge status: Accepted
N,M=map(int, input().split())
a = list(map(int, input().split()))
z = sum(a)
a.sort(reverse=True)

for i in a[:M]:
    if i < z/4/M:
        print('No')
        break
else:
    print('Yes')
# Judge status: Accepted
K,X=map(int,input().split())
ans=[]
n=0
for i in range(X-K+1,X+K):
    ans.append(i)
print(*ans)
# Judge status: Accepted
n = int(input())
list_A = list(map(int, input().split()))

colors = set()
other = 0
for num in list_A:
    num //= 400
    if num > 7:
        other += 1
    else:
        colors.add(num)

max_value = len(colors) + other
min_value = len(colors)

if len(colors) == 0:
    min_value = 1

print(min_value, max_value)
# Judge status: Accepted
n,a,b = map(int, input().split())
if (a-b) % 2 == 0:
  print(abs(a-b)//2)
else:
  print(min(a + (b - a - 1) // 2, n - b + 1 + (b - a - 1) // 2))
# Judge status: Accepted
n,k=map(int,input().split())
h=[]
for i in range(n):
    h.append(int(input()))

#n=5
#k=3
#h=[10,15,11,14,12]
#h=[5,7,5,7,7]

h.sort()
hd=[]
for i in range(n-k+1):
#    print(i,i+k-1,n-k)
    hd.append(h[i+k-1]-h[i])
print(min(hd))
# Judge status: Accepted
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N,M = map(int, input().split())
    i = 1
    for m in range(M):
        if N%2 == 0 and i%2 == 1 and i >= N/2:
            i += 1
        print(M-m,M-m+i)
        i += 2
    

main()
# Judge status: Accepted
X,Y=map(int,input().split())

if X%Y==0:
  print(-1)
else:
  print(X)
# Judge status: Accepted
n,l=map(int,input().split())
a=sorted([input() for i in range(n)])
t=""
for i in a:
    t+=i
print(t)
# Judge status: Accepted
import re
a,b = list(map(int,input().split()))
s = input()
if s[a]=="-":
  if "-" not in s[:a]+s[(a+1):]:
    print("Yes")
    exit()
print("No")
# Judge status: Wrong Answer
def agc005_a():
  x = str(input())
  # 文字列の逆順
  x_rev = x[::-1]
  # 取り尽くせないもの、先頭Tの個数、末尾Sの個数、の大きいほうの2倍が答え？
  head_t = x.find('S')
  tail_s = x_rev.find('T')
  ans = 2 * max(head_t, tail_s)
  print(ans)

agc005_a()
# Judge status: Wrong Answer
a,b = map(int, input().split())
print(b - a // b)
# Judge status: Accepted
def resolve():
    x, k, d = map(int, input().split())
    x = abs(x)
    if x // d > k:  # 最大長が0まで届くか
        print(x - k * d)
    elif (k - x // d) % 2 == 0:  # 0を反復横跳びする     偶数->X側、奇数->-X側
        print(x % d)
    else:
        print(d - x % d)
        
resolve()
# Judge status: Accepted
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N = int(input())

ans = [N]*(N+1)
ans[0] = 0

for i in range(1,N+1):
    c6 = 1
    while c6 <= i:
        ans[i] = min(ans[i], ans[i-c6]+1)
        c6 *= 6
    c9 = 1
    while c9 <= i:
        ans[i] = min(ans[i], ans[i-c9]+1)
        c9 *= 9

print(ans[N])
# Judge status: Accepted
x=int(input())
print((x//11)*2 + (x%11) // 6 + (1 if x%11%6 else 0))
# Judge status: Wrong Answer
x = int(input())

print((x-1)//11 + ((x-1)%11)//6)
# Judge status: Accepted
S = list(input())

S1 = S[0]
count = 0
for i in range(1,4):
  if S1 != S[i]:
    count += 1
    S1 = S[i]
if count == 3:
  print("Good")
else:
  print("Bad")
# Judge status: Accepted
n=int(input())
ans=0
for i in range(n//4+1):
    for j in range(n//7+1):
        if i*4+j*7==n:
            ans=1
print("Yes" if ans==1 else "No")
# Judge status: Accepted
h, n = (int(x) for x in input().split())
ab = []
for _ in range(n):
    a, b = (int(x) for x in input().split())
    ab.append([a, b])
max_a = max(a for a, _ in ab)
dp = [0] * (h + max_a)
for i in range(1, h + 1):
    dp[i] = min(dp[i - a] + b for a, b in ab)
print(dp[h])
# Judge status: Accepted
lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
k = int(input())
index = 0
while True:
	if len(lun_luns) >= k:
		break
	num = lun_luns[index]
	mod = num % 10
	n = num * 10
	if mod == 9:
		lun_luns.extend([n+mod-1, n+mod])
	elif mod == 0:
		lun_luns.extend([n, n+1])
	else:
		lun_luns.extend([n+mod-1, n+mod, n+mod+1])
	index += 1
print(lun_luns[k-1])
# Judge status: Accepted
x,a,b = map(int,input().split())
if -a+b <= 0:
    print('delicious')
elif -a+b <= x:
    print('safe')
else:
    print('dangerous')
# Judge status: Wrong Answer

n,m=map(int,input().split())
py=[]
for i in range(m):
    py.append([i]+list(map(int,input().split())))

py.sort(key=lambda na:(na[1],na[2]))

count=0
m_city=py[0][1]
for i in range(m):
    si=py[i][1]
    if m_city==si:
        count+=1
        py[i].append(count)
    else:
        count=1
        py[i].append(count)
    
py.sort(key=lambda na:na[0])
for i in range(m):
    print('{:0>6}'.format(py[i][1]),end="")
    print('{:0>6}'.format(py[i][3]))
# Judge status: Accepted
import math


def f(A, m, K):
    p = sum([a // m for a in A])
    if p > K:
        return False
    else:
        return True


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


left = 0
right = 10 ** 9 + 1

while int(left) != int(right):
    m = (left + right) / 2

    if f(A, m, K):
        right = m
    else:
        left = m


print(math.ceil(m))
# Judge status: Accepted
N = int(input())

A = []
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        A.append(i)

print(A[-1]+N//A[-1]-2)
# Judge status: Wrong Answer
def main():
    import sys
    input = sys.stdin.buffer.readline
    n = int(input())
    if (m:= n%10) in [2,4,5,7,9]:
        print('hon')
    elif m in [1,6,8]:
        print('pon')
    else:
        print('bon')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from sys import stdin
input = stdin.readline

def main():
    N, W = map(int, input().split())
    wv = list(map(int, input().split()) for _ in range(N))
    
    dp = [0] * (W + 1)
    
    for w, v in wv:
        for i in range(W, w, -1):
            dp[i] = max(dp[i], dp[i - w] + v)
    
    print(dp[-1])
if __name__ == '__main__':
    main()
# 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+(y*(n-k)))
# Judge status: Accepted
n,m=map(int,input().split())
ans=[]
for i in range(int(m**0.5)):
  if m%(i+1)==0:
    ans.append(i+1)
    ans.append(m//(i+1))
ans.sort()
for i in range(len(ans)):
  if n*ans[i]>m:
    break
  ans1=ans[i]
print(ans1)
# Judge status: Accepted
a,b,c=map(int,input().split())
d=0
while a%2==0 and b%2==0 and c%2==0:
    if a==b==c:
        print(-1)
        break
    d+=1
    ha=a//2
    hb=b//2
    hc=c//2
    a=hb+hc
    b=ha+hc
    c=ha+hb
else:print(d)
# Judge status: Accepted
h,w=map(int,input().split())
if h==1 or w==1:
  ans=1
else:
  ans=(h*w)//2
  if h*w%2==1:
    ans+=1
print(ans)
# Judge status: Accepted
S=list(str(input()))
S_int = [int(s) for s in S]
N=len(S)

A1 = [0]*N#0から始まる
A2 = [0]*N#1から始まる
for i in range(N):
  if i%2==0:
    A2[i]=1
  else:A1[i]=1
count1=0
count2=0
for i in range(N):
  if S_int[i]!=A1[i]:
    count1 += 1
  if S_int[i]!=A2[i]:
    count2 += 1
print(min(count1,count2))
# Judge status: Accepted
from fractions import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))

ans = abs(x[0]-X)

for i in x[1:]:
    ans = gcd(ans, abs(i-X))
print(ans)
# Judge status: Accepted
a = input()
b = a.split()
x = b[1]
y = x[0]
print("A", y, "C", sep = '')
# Judge status: Accepted
import itertools
import math
import fractions
import functools
n = input()
for i in range(len(n)):
    if n[i] == "7":
        print("Yes")
        quit()

print("No")
# Judge status: Accepted
N=int(input())
L1=list(map(int,input().split()))
L2=[0]*N
for i in range(N-1):
    if L1[i]>=L1[i+1]:
        L2[i]+=1
        L2[i+1]+=L2[i]
print(max(L2))
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(N)]

ans = 0
tmp = 1
for i in range(1, N):
    if A[i] <= A[i - 1]:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 1
else:
    ans = max(ans, tmp)

print(ans)
# Judge status: Wrong Answer
N = int(input())
ans = [0]*10050
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if v < 10050:
        ans[v] += 1
for i in range(N+1):
  print(ans[i+1])
# Judge status: Accepted
#1
import sys
n = int(input())
a = []
for i in range(n):
    j = int(input())
    a.append(j)
    
point = a[0]
cnt = 1
for i in range(n):
    if point == 2:
        print(cnt)
        sys.exit()
    point = a[point-1]
    cnt +=1
    
print("-1")
# Judge status: Accepted
n,m = map(int,input().split())
ps = [0] * m
for i in range(m):
    ps[i] = list(map(str,input().split()))
if m == 0:
    print(0,0)
    exit()
countA = [0] * n
countW = [0] * n
cn = 0
for item in ps:
    if item[1] == 'AC' and countA[int(item[0])-1] == 0:
        countA[int(item[0])-1] = 1
        cn += countW[int(item[0])-1]
    else:
        countW[int(item[0])-1] += 1
print(sum(countA),cn)
# Judge status: Accepted
n = int(input())

a = [2,1]

for x in range(n-1):
  a.append(a[x] + a[x+1])
  
print(a[-1])
# Judge status: Accepted
n = int(input())

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

res = 0
flag = True
while True:
    for i in range(n):
        if al[i] % 2 ==0:
            al[i] = al[i] //2
            
        else:
            flag = False
            break
    if flag ==False:
        break        
    res +=1

print(res)
# Judge status: Wrong Answer
X = int(input())
print(360 / X)
# Judge status: Wrong Answer
N = int(input())
l = [0] * (N+1)
m = [1] * (N+1)
counter = 1
m[0] = 0
for i in range(2,N+1):
    if l[i] == 0:
        flag = True
        for j in range(1, N//i + 1):
            if i * j > N:
                break
            l[i * j] = 1
            m[i * j] += j
    counter += m[i] * i
print(counter)
# Judge status: Wrong Answer
n, k = map(int, input().split())
r, s, p = map(int, input().split())
d = {"r":p, "s":r, "p":s}
t = input()
dp = [0]*n
for i in range(n):
  if i<k and dp[i-k]==d[t[i]]:
    dp[i] = 0
    t[i] = x
  else:
    dp[i] = d[t[i]]
print(sum(dp))
# Judge status: Wrong Answer
x=[0,1,2]
y=[3,4,5]
x+=y[:]
print(x)
# Judge status: Accepted
n = int(input())
s = input()
MOD = 10 ** 9 + 7

t = [0 for i in range(26)]

for i in range(n):
    t[ord(s[i]) - ord("a")] += 1

ans = 1
for i in range(26):
    if t[i] == 0:
        continue
    if t[i] == 1:
        ans *= 2
    elif t[i] > 1:
        ans *= t[i] + 1

print((ans-1) % MOD)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
adict=dict()
for i in range(n):
  if adict.get(a[i])!=None:
    adict[a[i]]+=1
  else:
    adict[a[i]] = 1
cnt=0

for i in range(len(adict)):
  if adict[a[i]]>=a[i]:
    cnt+=(adict[a[i]]-a[i])
  else:
    cnt+=adict[a[i]]
print(cnt)
# Judge status: Wrong Answer
N, K = map(int, input().split())
l = list(map(int, input().split()))

is_zero = l.count(0)
K -= is_zero

if K:
    ans = float('inf')
    for i in range(1, N-K+1):
        lb, rb = l[i], l[i+K-1]
        steps = abs(rb-lb) + min(abs(rb), abs(lb))
        ans = min(ans, steps)

    print(ans)
else:
    print(0)
# Judge status: Accepted
import bisect

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q
for i in range(Q):
    B[i], C[i] = map(int, input().split())

DP = [0]*(10**5+1)

for i in range(len(A)):
    DP[A[i]] += 1

Sum = sum(A)

for i in range(Q):
    Sum += (C[i]-B[i])*DP[B[i]]
    DP[C[i]] += DP[B[i]]
    DP[B[i]] = 0
    print(Sum)
# Judge status: Wrong Answer
n=int(input())
 
t = list(map(int,input().split()))
 
a1 = max(t)
 
ans = 100000000000000
 
memo = 0

for i in t:
    if ans >= abs(a1//2-i):
        ans = abs(a1//2-i)
        memo = i
print(a1, memo)
# Judge status: Wrong Answer
n,k=input().split()
d=set(range(10))-set(map(int,input().split()))
p=0
l=[0]*10
for i in range(10):
    if i in d:
        l[p:i+1]=[i for j in range(i-p+1)]
        p=i+1
if p!=10:
    d.discard(0)
    i=min(d)*10
    l[p:]=[i for j in range(10-p)]
#print(l)
p=0
t=len(n)
for i in range(t):
    p+=10**(t-i-1)*l[int(n[i])]
print(p)
# Judge status: Accepted
n, k = map(int, input().split())
s = list(input())

if s[k-1]=='A':
    s[k-1] = 'a'
if s[k-1]=='B':
    s[k-1] = 'b'
if s[k-1]=='C':
    s[k-1] = 'c'
print(''.join(s))
# Judge status: Accepted
s=t=0
for i in input():
    if i=="S":s+=1
    elif s>0:s-=1
    else:t+=1
print(s+t)
# Judge status: Accepted
n, d = map(int, input().split())
x = d*2+1
if n % x == 0:
    print(n//x)
else:
    print(n//x + 1)
# Judge status: Wrong Answer
a,b,c=map(int,input().rstrip().split(' '))
if(a==b and b==c):
	print(-1)
else:
	n=0
	while(a%2==0 and b%2==0 and c%2==0):
		n+=1
		tmp_a=(b+c)/2
		tmp_b=(a+c)/2
		tmp_c=(b+a)/2
		a=tmp_a
		b=tmp_b
		c=tmp_c
	print(n)
# Judge status: Wrong Answer
from math import ceil


def main():
    target = int(input())
    print(ceil(2 * target / 11))


if __name__ == '__main__':
    main()
# Judge status: Accepted
l = [int(input()) for _ in range(5)]
k = int(input())
if l[4] - l[0] > k:
    print(':(')
else:
    print('Yay!')
# Judge status: Accepted
import collections
S = input()
N = len(S)
mod = 2019
div = [0]*(N+1)
for i in range(N):
    div[i+1] = (div[i] + int(S[N-1-i])*pow(10,i,mod))%mod
d = collections.Counter(div[1::])
ans = d[0]
for i in d.values():
    ans += i*(i-1)//2
print(ans)
# Judge status: Accepted
def cmb(n, r, p):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res *= pow(i+1, p-2, p)  # 分母の逆元(フェルマーの定理)
        res *= n-i  # 分子
        res %= p
    return res

p = 10 ** 9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, p) - 1
ans -= cmb(n, a, p) + cmb(n, b, p)
print(ans % p)