peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
L = 10**2+10
n = int(input())
ans = [0] * n
for i in range(1, L):
    for j in range(1, L):
        for k in range(1, L):
            x = i**2+j**2+k**2+i*j+j*k+i*k
            if x <= n:
                ans[x-1] += 1
print(*ans, sep="\n")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
kill = 0

for i in range(n):
    for j in range(i,i+2):
        if b[i] <= a[j]:
            kill += b[i]
            a[j] -= b[i]
            continue
        else:
            kill += a[j]
            b[i] -= a[j]

print(kill)
# Judge status: Wrong Answer
import math


def calc(n, c, d):
    return n-(math.floor(n / c) +
              math.floor(n / d) - math.floor(n / (c * d / math.gcd(c, d))))


def calc2(n, m):
    return n-(math.floor(n / m))


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

    print(calc(b, c, d)-calc(a-1, c, d))


if __name__ == "__main__":
    main()
# Judge status: Accepted
s=input()
ans=""
for i in s:
  if ans =="" and i=="B":
    continue
  elif ans != "" and i == "B":
    ans = ans[:-1]
  else:
    ans += i
print(ans)
# Judge status: Wrong Answer
k,x = map(int,input().split())
print(list(range(x-k+1,x+k)))
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
MOD=10**9+7
tmp1 = 0
tmp2 = 0
for a in A:
    tmp1 += a
    tmp2 += (a**2)

ans = (tmp1**2 - tmp2)//2
print(ans%MOD)
# Judge status: Accepted
n=int(input())
a=[0]*(n+1)
for i in range(n+1):
    if i%3==0 or i%5==0:
        a[i]=0
    else:
        a[i]=i
print(sum(a))
# Judge status: Accepted
x=int(input())

if 400<=x<600:ans=8
if 600<=x<800:ans=7
if 800<=x<1000:ans=6
if 1000<=x<1200:ans=5
if 1200<=x<1400:ans=4
if 1400<=x<1600:ans=3
if 1600<=x<1800:ans=2
if 1800<=x<2000:ans=1

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

if a%3 == 0 or b %3 == 0 or (a + b)%3 == 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Wrong Answer
# -*- using:utf-8 -*-

def factorial_cor(n):
  fact = 1
  for integer in range(1, n + 1):
    fact *= integer
  return fact

if __name__ == "__main__":
  MOD = 1000000007
  N = int(input())
  if N == 1:
    print(0)
  elif N == 2:
    print(2)  
  else:
    C = factorial_cor(N)
    ten = 10 ** (N - 2) * C
    ans = C % MOD
    print(int(ans))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0

for i in range(60):
    cou  = 0
    bit = 1 << i
    for j in a:
        if j & bit:
            cou += 1
    num1 = cou
    num0 = n - num1
    ans += ((num1*num0) * bit )%mod
print(ans%mod)
# Judge status: Wrong Answer
from fractions import gcd
a,b,c,d = map(int,input().split())

lcm = c*d / gcd(c,d)
x = lcm
div = 0
while a <= x <= b:
    div += 1
    x  += lcm
    
cdiv = b//c - (a-1)//c
ddiv = b//d - (a-1)//d

print(b-a+1-cdiv-ddiv+div)
# Judge status: Wrong Answer
H1,M1,H2,M2,K = map(int,input().split())

if (M1 < M2):
  H = H2 - H1 - 1
  M = M1 - M2
else:
  H = H2 - H1
  M = M2 - M1

T = H * 60 + M

if T > K:
  print(T - K)
else:
  print("0")
# Judge status: Accepted
a, b, c = map(int, input().split())
a, b = b, a
a, c = c, a
print(a, b, c)
# Judge status: Wrong Answer
def main():
    s = list(input())
    if len(s) % 2 == 0:
        del s[-2:]
    else:
        del s[-1]
    
    half_len = len(s) // 2

    for i in range(0, half_len, 2):
        if s[:half_len-(i//2)] == s[half_len-(i//2):]:
            break
        else:
            del s[-2:]

    print(len(s))

if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import Counter
n = int(input())
s = [None] * n
for i in range(n):
  s[i] = Counter(input())
ans = ""
for c in "abcdefghijklmnopqrstuvwxyz":
  cc = 50
  for si in s:
    cc = min(si.get(c, 0), cc)
  ans += c * cc
print(ans)
# Judge status: Accepted
import re
given = input()
answer = re.sub(r'hi', "*", given)
if len(set(answer)) == 1 and answer[0] == "*":
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
   
count = 0
for n in range(0, N+1):
    if 1 <= n <= 9:
        count = count + 1
    if 100 <= n <= 999:
        count = count + 1
    if 10000 <= n <= 99999:
        count = count + 1
print(count)
# Judge status: Accepted
n, c, k = map(int, input().split())
T = list(int(input()) for _ in range(n))
T.sort()

lmt = 0
flg = True
tmp_c = c
bus_cnt = 0
for i in range(len(T)-1):
    if flg:
        lmt = T[i] + k
        flg = False
        bus_cnt += 1
    if tmp_c >= 0 or lmt >= T[i]:
        tmp_c -= 1
    if tmp_c <= 0 or lmt < T[i+1]:
        flg = True
        tmp_c = c
else:
    if tmp_c <= 0 or lmt < T[-1]:
        bus_cnt += 1

print(bus_cnt)
# Judge status: Accepted
import fractions
A, B = map(int, input().split())

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

ans = lcm(A, B)
print(ans)
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())
a = max(h,w)
b = a
count = 0
if h*w == n:
  print(h)
elif b >= n:
  print(1)
else:
 while b <= n:
   b += a
   count += 1
 print(count)
# Judge status: Wrong Answer
import math
from functools import reduce
from itertools import *
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
 
K = int(input())
ans = 0
seq = [i for i in range(1,K+1)]
s = sum(seq)
seq = list(combinations_with_replacement(seq,3))
for a,b,c in seq:
  if a == b and b == c:
    continue
  ans += gcd(a,b,c)

print(ans*3+s)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
s=input()
s=[s[i] for i in range(len(s))]
s=s[:len(s)-1]
if s[0]=='?':
  s[0]='D'
if s[-1]=='?':
  s[-1]='D'
for i in range(len(s)-2):
  if s[i+1:i+3]==['?','?']:
    s[i+1]='P'
    s[i+2]='D'
  elif s[i]==s[i+2]=='D':
    s[i+1]='P'
  else:
    s[i+1]='D'
print(''.join(s))
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]
count = 1
status = 0

for i in range(N-1):
  if (A[i+1] - A[i]) == 0:
    continue
  elif (A[i+1] - A[i]) > 0:
    if status == 0 or status == 1:
      status = 1
      continue
    else:
      count += 1
      status = 0
      
  elif (A[i+1] - A[i]) < 0:
    if status == 0 or status == -1:
      status = -1
      continue
    else:
      count += 1
      status = 0
print(count)
# Judge status: Accepted
N,X=map(int,input().split())
L=list(map(int,input().split()))
for i in range(N-1):L[i+1]+=L[i]
count=1
for i in range(N):
    if L[i]<=X:count+=1
print(count)
# Judge status: Wrong Answer
a,b = input().split()
a = int(a)
b = int(b)
A = (a*a-1)/2
B = (b*b-1)/2
if a <= 2 and b <= 2:
  print(0)
elif a <=2 and b >= 1:
  print(B)
elif a >= 1 and b <= 2:
  print(A)
elif a>= 1 and b >=1:
  print(A+B)
# Judge status: Wrong Answer
import numpy as np
N, A, B = map(int, input().split())

total = 0
for i in range(N+1):
  a = i
  lis =[]
  while i >0:
    lis.append(i%10)
    i //=10
  lis.reverse()
  lis = np.array(lis)
  SUM = np.sum(lis)

  if SUM >=A and SUM <=B:
    total += a
# Judge status: Accepted
import math

X = int(input())

def era(n):
    O = [i + 2 for i in range(n-1)]
    P = []
    for i in range(int(math.sqrt(n))):
        P.append(O[0])
        O = [o for o in O if o % P[-1] != 0]
    for o in O:
        P.append(o)
    return P

P = era(2*X)
for i in range(len(P)):
    if X <= P[i]:
        print(P[i])
        break
# Judge status: Accepted
N,X,T = map(int, input().split()) 

if N%X==0:
    ans = (N/X) * T
else:
    ans = (N//X + 1) * T

print(int(ans))
# Judge status: Accepted
from itertools import permutations
def dist(x,y):
    return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
cnt = 0
for z in permutations(range(N),N):
    for i in range(1,N):
        cnt += dist(X[z[i]],X[z[i-1]])
k = 1
for i in range(2,N+1):
    k = k*i
print(cnt/k)
# Judge status: Accepted
x,y=map(int,input().split())
import bisect as bi
ans=1
for i in range(80):
    if x*2<=y:
        ans+=1
        x*=2
print(ans)
# Judge status: Wrong Answer
n,k= list(map(int, input().split()))
mod=10**9+7
ans=0
for i in range(k,n+2):
    min=(i-1)*i//2
    max=((n+1)+(n-i+1))*i//2
    ans+=max-min
print(ans % mod)
# Judge status: Accepted
string = input()
if string.isupper():
    print('A')
else:
    print('a')
# Judge status: Accepted
O = list(input())
E = list(input())+['']
print(*[o+e for o,e in zip(O,E)], sep='')
# Judge status: Accepted
A, B, C= map(int, input().split())
print(min(B//A,C))
# Judge status: Accepted
a = list(map(int,input().split()))

N = a[0]
M = a[1]

N_combi = N*(N-1)/2
M_combi = M*(M-1)/2

print(int(N_combi+M_combi))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

cnt = 0
for i in range(n-1, -1, -1):
    cnt += min(b[i], a[i]+a[i+1])
    diff = b[i] - a[i+1]
    if diff > 0:
        a[i] = max(0, a[i]-diff)

print(cnt)
# Judge status: Wrong Answer
N = int(input())
flag = False
for i in range(N//4):
    if (N-4*i) % 7 == 0:
        flag = True
        break
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A,B,T=map(int,input().split())
i=0
while A*i<=T:
    i=i+1
print(B*(i-1))
# Judge status: Accepted
x = int(input())
cnt = (x // 11)
x -= cnt*11
cnt *= 2
if x > 0:
    if x > 6:
        cnt += 2
    else:
        cnt += 1
print(cnt)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
c = 0

for i in range(N):
    c += a[1 + i*2]
print(c)
# Judge status: Wrong Answer
N = input()
if N[0] == '7' or N[1] == '7' or N[2] == '7':
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
d,t,s=map(int,input().split())
if 1000//15>=s:
  if 1000//15==s and 1000%15==0:
    print('Yes')
  else:
    print('No')
else:
  print('Yes')
# Judge status: Accepted
def main():
    
    a,b = map(int, input().split())
    if a <= 8 and b <= 8:
        print("Yay!")
    else:
        print(":(")
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n, k= map(int, input().split())
a = list(map(int, input().split()))
import collections

a = collections.Counter(a)
key = list(a.values())
#print(key)
key.sort()
#print(key)
ans = sum(key[:len(key)-k])
print(ans)
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a,b = map(int, input().split())
    if a%b == 0:
        print(-1)
    else:
        print(a)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# 入力
a = int(input())
b = int(input())
h = int(input())

# (a+b)*h/2
answer = (a + b) * h / 2
print(answer)
# Judge status: Accepted
d = int(input())
c = list(map(int, input().split()))
for _ in range(d):
    s = list(map(int, input().split()))
    print(s.index(max(s)) + 1)
# Judge status: Accepted
import itertools
r = 2
N, M = map(int, input().split())
Nmath = len(list(itertools.combinations(range(N), r)))
Mmath = len(list(itertools.combinations(range(M), r)))

print(int(Nmath+Mmath))
# Judge status: Accepted
from collections import defaultdict
from bisect import bisect
n,m=map(int,input().split())
l=[tuple(map(int,input().split())) for _ in range(m)]
a=defaultdict(list)
for x,y in sorted(l):
    a[x]+=[y]

for x,y in l:
    z=bisect(a[x],y)
    print('%06d%06d'%(x,z))
# Judge status: Wrong Answer
import fractions
from functools import reduce

n, x = map(int, input().split())
xx = list(map(int, input().split()))
xx.sort()

if n == 1:
    ans = xx[0] - x
else:
    dist = [xx[i + 1] - xx[i] for i in range(n - 1)]
    ans = reduce(fractions.gcd, dist)

print(ans)
# Judge status: Wrong Answer
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

MOD = 10**9+7
N,M = map(int, input().split())

if N < M: N,M = M,N

ans = 1
if N-M == 0:
    for i in range(M):
        ans *= i
        ans % MOD
    ans = (ans*ans)%MOD
elif N-M == 1:
    for i in range(M):
        ans *= i
        ans %= MOD
    ans = (ans*ans*2)%MOD
else: ans = 0

print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3

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

ans = 1
num = int(m**0.5)+1

for i in range(1, num):
    if m % i != 0:
        continue
    j = m//i
    if i >= n:
        ans = max(ans, j)
    # if j >= n:
    #     ans = max(ans, i)
print(ans)
# Judge status: Wrong Answer
st=input()
n=len(st)
if(n%2==0):
	print("No")
	exit(0)
if(st==st[::-1]):
	s1=""
	for i in range((n-1)//2+1):
		s1+=st[i]
	s2=""
	for i in range((n+3)//2,n):
		s2+=st[i]
	if(s1==s1[::-1] and s2==s2[::-1]):
		print("Yes")
	else:
		print("No")
else:
	print("No")
# Judge status: Accepted
n = int(input())
p = list(input().split())
q = list(input().split())

l = list(range(1, n+1))
ll = []

def Count_Order(n, s):
    if n == 0:
        ll.append("".join(list(map(str, s))))
    else:
        for x in l:
            if not x in s:
                Count_Order(n-1, s+[x])

s = []
Count_Order(n, s)
print(abs(ll.index("".join(p)) - ll.index("".join(q))))
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
A_ = min(A, K)
print(A_, min(0, B-(K-A_)))
# Judge status: Accepted
N, M = [int(v) for v in input().split()]
H = [int(v) for v in input().split()]
is_good = [True] * N
for i in range(M):
    A, B = [int(v) - 1 for v in input().split()]
    if H[A] <= H[B]:
        is_good[A] = False
    if H[A] >= H[B]:
        is_good[B] = False
print(sum(is_good))
# Judge status: Wrong Answer
#!/usr/bin/env python3


def main():
    c = input()
    # i = list(map(int,input().split()))
    # j = list(map(int,input().split()))
    if c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'e':
        print('vowel')
    else:
        print('consonant')


main()
# Judge status: Accepted
s = input()
t = input()
for i in range(len(s)+5):
    if s == t:
        print("Yes")
        break
    s = s[-1] + s[:-1]
else:
    print("No")
# Judge status: Accepted
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(X)
y.append(Y)
x.sort()
y.sort()

if x[-1] >= y[0]:
    print("War")
else:
    print("No War")
# Judge status: Accepted
a,b=map(int, input().split())
if a%b==0:
  print(0)
else:
  print(1)
# Judge status: Accepted
def main():
    S = input()
    is_keyence = False
    string = "keyence"

    for i in range(len(string)):
        if S.startswith(string[:i]) and S.endswith(string[i:]):
            is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a, b, x = map(int,input().split())

if a+b > b:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
from sys import stdin

K = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()


if len(S) <= K:
    print(S)
else :
    print(S[:K]+"...")
# Judge status: Wrong Answer
#美しい文字列　044_B

w=input()
count=0
ans='Yes'
for i in range(len(w)):
    t=w[i]
    for e in range(len(w)):
        t==w[e]
        count=count+1
        if count%2==1:
            ans='No'
        else:
            ans='Yes'

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
A = [None] * K
for i in range(K):
    d = int(input())
    A[i] = list(map(int, input().split()))

flat_list = [s for a in A for s in a]
set_a = set(flat_list)
ans = 0

for i in range(1, N + 1):
    if not i in set_a:
        ans += 1

print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
x = any((a*i)%b==c for i in range(1,b+1))
print(x)
print("Yes" if x else "No")
# Judge status: Wrong Answer
a, b, c = map(int, input().split(" "))
print((b + c) - a)
# Judge status: Wrong Answer
x = int(input())

if x<=6:
    print(1);exit()
if x<=11:
    print(2);exit()
ans=(x//11)*2
b = x-x//11*11
if b<=6:
    ans+=1
else:
    ans+=2
print(ans)
# Judge status: Wrong Answer
S='apple'
T='apple'
count=0;
for i in range(0,len(S)):
    if (T[i]!=S[i]):
        count+=1
print(count)
# Judge status: Wrong Answer
s=input()
t=input()
n=0
if(len(t)==len(s)+1):
  for i in range(0,len(s)):
    if(s[i]==t[i]):
      n=n+1
if(n==len(s)):
  print("Yes")
else:
  print("Np")
# Judge status: Wrong Answer
from fractions import gcd
N,X=map(int,input().split())
x=list(map(int,input().split()))
z=x+[X]
z.sort()

if N>1:
  y=[0]*N
  for i in range(N):
    y[i] = z[i+1]-z[i]
  ans=y[0]
  for j in range(N):
    ans = gcd(z[j],ans)
  print(ans)
else:
  print(abs(X-x[0]))
# Judge status: Wrong Answer
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(d)]
a = 0
S = 0
b = []

for j in range(d):
    for k in range(26):
        if S < s[j][k]:
            S = s[j][k]
            K = k
            b.append(k)

print(*b,sep="\n")
# Judge status: Accepted
s = input()
n = s[::2].count('0') + s[1::2].count('1')
print(min(n, len(s) - n))
# Judge status: Accepted
N = int(input())
S = list(input())
alphabet = ["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"]
new_S = []
for i in range(len(S)):
  s = alphabet.index(S[i])+N
  if s >= 26 :
    s -= 26
  new_S.append(alphabet[s])
print("".join(new_S))
# Judge status: Wrong Answer
print(sum(sorted(list(map(int,input().split()))[:2])))
# Judge status: Wrong Answer
n = int(input())
inputs = list(map(int,input().split()))
As = []
sum = 0
step =0
for i in inputs:
    As.append(int(i))
try:
    for i in range(len(As)):
        if As[i] < As[i + 1]:
            step = As[i + 1] - As[i]
            sum += step 
except:
    pass

print(sum)
# Judge status: Accepted
A, B, C, D = map(int, input().split())

def gcd(a, b):
    if (b==0):
        return a
    else:
        return gcd(b, a % b)

G = C * D // gcd(C, D)

ans_b = B - B//C - B//D + B//G
ans_a = A - 1 - (A-1)//C - (A-1)//D + (A-1)//G

print(ans_b - ans_a)
# Judge status: Wrong Answer
s=input()
ans=1000
for i in range(len(s)-3):
    n=''
    n+=s[i]
    n+=s[i+1]
    n+=s[i+2]
    n=int(n)
    ans=min(abs(n-753),ans)
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

p = 0
m = 0
cnt = 0
for i in range(N-1):
    if(A[i] < A[i+1]):
        p = 1
    elif(A[i] == A[i+1]):
        continue
    else:
        m = 1
    if(p == m == 1):
        cnt += 1
        p = 0
        m = 0
print(cnt+1)
# Judge status: Wrong Answer
import collections 
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
c=defaultdict(int)
for s in a:
    c[s]+=1
print(c)

a1=list(set(a))
print(a1)

total=0
for j in range(len(a1)):
    x=c[a[j]]
    print(x)
    total+=x*(x-1)/2
    print('total=',total)

for i in range(n):
    ans=total-c[a[i]]+1
    print(int(ans))
# Judge status: Wrong Answer
n,m = map(int,input().split())
dp = [1]*(n+1) 
dp[1] = 2
mod = 10**9 + 7
for i in range(m):
    a = int(input())
    dp[a-1] = 0
if dp[0] == 0:
    dp[1] =1

for i in range(1,n+1):
    if dp[i] == 0:
        continue
    else:
        if i == 1:
            dp[i] = dp[i-1] +1
        else:
            dp[i] = (dp[i-1] + dp[i-2])%mod
        #print(dp)
print(dp[n-1])
# Judge status: Wrong Answer
S = str(input())

if (S[0]==S[1] and S[2]==S[3]) or (S[0]==S[2] and S[1]==S[3]) or (S[0]==S[3] and S[1]==S[2]):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from sys import exit
def dfs(i,f,sum):
  if i == n-1:
    if sum ==7:
      return print(f,"=7")
      exit()
      
  else:
    dfs(i + 1, f + "+" + s[i + 1], sum+int(s[i+1]))
    dfs(i + 1, f + "-" + s[i + 1], sum-int(s[i+1]))



s=input()
n=len(s)
dfs(0, s[0],int(s[0]))
# Judge status: Wrong Answer
n = int(input())
r = 1
while r < n:
  r *= 2

print(int(r/2))
# Judge status: Accepted
#!/usr/bin/env python3

import sys

input = sys.stdin.buffer.readline

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

XY = list()
for i in range(N):
    XY.append((A[i], i+1))
XY.sort()

Ans = list()
for x,y in XY:
    Ans.append(y)

print(*Ans)
# Judge status: Accepted
n = input()
a = sum([int(n[i]) for i in range(len(n))])
if a==1:
    print(10)
else:
    print(a)
# Judge status: Accepted
X = int(input())
i = 0
Y = X
while Y % 360 != 0:
  Y += X
  i += 1

i += 1  
print(i)
# Judge status: Accepted
import numpy as np
import math
H = int(input())

cnt = np.log2(H)
cnt = math.floor(cnt)
cnt = 2**(cnt + 1) - 1
print(cnt)
# Judge status: Accepted
N = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i]==L[j] or L[j]==L[k]: continue
            if L[i]+L[j]>L[k]: ans+=1

print(ans)
# Judge status: Wrong Answer

n = int(input())
data = ["a"] * n
ans = ["".join(data)]
def print_str(ans, data, i):
    if i == n:
        return
    while ord(data[i]) + 1 <= ord(data[i - 1]) + 1:
        data[i] = chr(ord(data[i]) + 1)
        ans.append("".join(data))
        print_str(ans, data, i + 1)

print_str(ans, data, 1)
ans = sorted(set(ans))
for i in range(len(ans)):
    print(ans[i])
# Judge status: Wrong Answer
i = int(input())
if i <= 30:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N, K = map(int, input().split())
t = 0

while(K**t < N):
	#print(K**t)
	t+=1

print(t)
# Judge status: Accepted
S = input()
N = len(S)
ans = float("inf")
for i in range(N-2):
  ans = min(ans, abs(753 - int(S[i:i+3])))

print(ans)
# Judge status: Accepted
n = int(input())
aList = list(map(int, input().split()))
aList.sort()
aList = aList[n:]
sums = 0
for i in range(2 * n):
    if i % 2 == 0:
        sums += aList[i]
print(sums)
# Judge status: Accepted
# -*- coding:utf-8 -*-
import re
S = input()
S_sp = re.split("[^ACGT]",S)
ans = 0
for moji in S_sp:
    if len(moji) > ans:
        ans = len(moji) 

print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())

if (n == 2 and m != 1) or (m == 2 and n != 1):
  print(0)
elif n ==1 and m != 1:
  print(m-2)
elif m == 1 and n != 1:
  print(n-2)
elif n == 1 and m == 1:
  print(1)
else:
  print((n+m-2)*2)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A.sort()
MAX = A[-1]+1
num_tmp = [0]*MAX

for a in A:
    num_tmp[a] += 1
    if num_tmp[a] == 1:
        for i in range(2*a,MAX,a):
            num_tmp[i] = 2

print(num_tmp.count(1))
# Judge status: Accepted
n=int(input())
i=1
num=0
suml=[0]
while num<=10**7+1000:
    num+=i
    suml.append(num)
    i+=1

j=1
while n>suml[j]:
    j+=1
k=suml[j]-n
for ii in range(1,j+1):
    if ii!=k:
        print(ii)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
ans = 0
tmp = 0
for i in range(1,n):
    if h[i] <= h[i - 1]:
        tmp += 1

    else:
        ans = max(ans, tmp)
        tmp = 0
ans = max(ans,tmp)
print(ans)
# Judge status: Accepted
a=[int(input())]
cnt=0
flag=True
while flag:
  cnt+=1
  if a[cnt-1]%2:
    a.append(3*a[cnt-1]+1)
  else:
    a.append(a[cnt-1]//2)
  for i in range(cnt):
    if a[i]==a[cnt]:flag=False

print(cnt+1)
# Judge status: Accepted
a,b,c,d = map(int, input().split())
array = []
array.append(a*c)
array.append(b*d)
array.append(a*d)
array.append(b*c)
if (a <= 0 and b >= 0) or (c <= 0 and d >= 0):
    array.append(0)
print(max(array))
# Judge status: Accepted
import sys
from collections import defaultdict


n, *s = sys.stdin.read().split()
d = defaultdict(int)
ans = 0
for si in s:
    d[''.join(sorted(si))] += 1
for x in d.values():
    ans += x * (x - 1) // 2
print(ans)
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
x = a/d
y = c/b
if 1 <= x and 1 <= y:
    print('Yes')
else:
    print('Yes' if x <= y else 'No')
# Judge status: Accepted
n,k = map(int,input().split())
l = list(map(int,input().split()))
m = 10**9
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  m = min(m,b-a+min(abs(a),abs(b)))
print(m)
# Judge status: Accepted
n = int(input())
s = input()

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in range(len(s)):
    ans+= alphabet[(alphabet.find(s[i])+n)%26]

print(ans)