Problem:
 Score : 200 points    Problem Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:   Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.       Constraints  1 \leq X \leq 179  X is an integer.         Input Input is given from Standard Input in the following format:  X       Output Print the number of times Takahashi will do the action before he is at the starting position again.        Sample Input 1 90      Sample Output 1 4  Takahashi's path is a square.       Sample Input 2 1      Sample Output 2 360

Solution (Python):
x = int(input())

k = 1
angle = x

while True:
    if angle >= 360 and angle % 360 == 0:
        break
    angle += x
    k += 1

print(k)

Solution (Python):
m = int(input())
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
x = make_divisors(360)


def gcd(a,b):
    if(b>a):
        a,b=b,a
    i=b
    while i>0:
        if(a%i==0 and b%i==0):
            return i
        i-=1


def lcm(a,b):
    return int(a*b/gcd(a,b))

y = lcm(m,360)

if m in x:
    print(360//m)
else:
    print(y//m)

Solution (Python):
x = int(input())

for i in range(1, 180):
    if 360 * i % x == 0:
        print(360 * i // x)
        break

Solution (Python):
x = int(input())
for i in range(1, 360+1):
    if (x*i)%360 == 0:
        print(i)
        exit()

Solution (Python):
import math;print(360//math.gcd(360,int(input())))

Solution (Python):
X = int(input())
import math
ans = 360 // math.gcd(360, X)
print(ans)

Solution (Python):
X = int(input())
import math
A = X // math.gcd(360, X)
ans = 360 * A // X
print(ans)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
x = I()
ans = 0
wa = 0
cont = True
while cont:
    wa += x
    ans += 1
    if wa % 360 == 0:
        cont = False
print(ans)

Solution (Python):
X=int(input())
from math import gcd

ans=360//gcd(X, 360)
print(ans)

Solution (Python):
def main():
    X = int(input())
    tmp = 0
    cnt = 0
    while True:
        tmp += X
        cnt += 1
        tmp %= 360
        if tmp == 0:
            break
    return cnt 

print(main())

Solution (Python):
X = int(input())

for k in range(3, 361):
    if (k*X)%360==0:
        print(k)
        exit()

Solution (Python):
import sys
import math

X = int(sys.stdin.readline())
for i in range(1, 10**5):
    if (X * i) % 360 == 0:
        print(i)
        break

Solution (Python):
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

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

def main():
    X = ri()
    K = 360 // gcd(360, X)
    print(K)


if __name__ == '__main__':
    main()

Solution (Python):
import math
N = int(input())
LCM = N*360//math.gcd(N,360)
ans = LCM//N
print(ans)

Solution (Python):
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
X = int(input())
a = gcd(360,X)
b = (X//a)*360
print(b//X)

Solution (Python):
from fractions import gcd

x = int(input())

print(x * 360 // gcd(x, 360) // x)

Solution (Python):
from math import gcd
X = int(input())
Y = X*360//gcd(X, 360)
print(Y//X)

Solution (Python):



a=int(input())







n=1
while True:
    if 360*n%a==0:
        print(360*n//a)
        exit()
    else:
        n+=1

Solution (Python):
X = int(input())

eikaku = X if X < 180 else X - 180
cnt = 0

ans = 0
while True:
    ans += 1
    cnt += eikaku
    if cnt % 360 == 0:
        print(ans)
        break

Solution (Python):
def main():
    
    
    
    
    x = int(input())
    i = 1
    while (x*i) % 360 != 0:
        i += 1
    print(i)


if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())
a = 1
for i in [2,2,2,3,3,5]:
  if x%i == 0:
    a *= i
    x //= i
print(360//a)

Solution (Python):
import math
x=int(input())
g=math.gcd(360,x)
print(360//g)

Solution (Python):
x = int(input())

num = 360

while True:
  if num % x == 0:
    print(num // x)
    break
  else:
    num += 360

Solution (Python):
def lcm(x, y):
   if x > y:
       greater = x
   else:
       greater = y
 
   while(True):
       if((greater % x == 0) and (greater % y == 0)):
           lcm = greater
           break
       greater += 1
 
   return lcm
x = int(input())
if 360%x == 0:
    print(int(360/x))
else :
    print(int(lcm(360,x)/x))

Solution (Python):
X = int(input())

if 360 % X == 0:
    print(360 // X)
    exit()
else:
    mod = 0
    cnt = 0
    while (360 + mod) % X != 0:
        cnt += (360 + mod) // X
        mod = (360 + mod) % X
    cnt += (360 + mod) // X

print(cnt)

Solution (Python):
x=int(input())
k=1
while (k*x)%360!=0:
  k+=1
print(k)

Solution (Python):
import math
n = int(input())
print(360*n//math.gcd(360,n)//n)

Solution (Python):
from math import gcd
X = int(input())

lm = (X*360)//gcd(X,360)
print(lm//X)

Solution (Python):
x=int(input())
k=1
while (k*x)%360!=0:
  k+=1
print(k)

Solution (Python):
def main():
    n = int(input())
    i = 1
    now = n
    while True:
        if now % 360 == 0:
            print(i)
            break
        else:
            i += 1
            now += n


main()

Solution (Python):
X=int(input())
i=1
while True:
    if (X*i)%360==0:
        print(i)
        exit()
    i+=1

Solution (Python):
X = int(input())

for i in range(1, 1000000):
    if (X * i) % 360 == 0:
        print(i)
        exit()

Solution (Python):
import sys
import math
def input(): return sys.stdin.readline().rstrip()
def main():
    x = int(input())
    xx = x
    ans = 1
    while xx%360 != 0:
        xx += x
        ans += 1
    print(ans )

if __name__=='__main__':
    main()

Solution (Python):
import sys
import math
def input(): return sys.stdin.readline().rstrip()
def main():
    x = int(input())
    xx = x
    ans = 1
    while xx%360 != 0:
        xx += x
        ans += 1
    print(ans )

if __name__=='__main__':
    main()

Solution (Python):
def gcd(a: int, b: int) -> int:
    return a if b == 0 else gcd(b, a%b)

def lcm(a: int, b: int) -> int:
    return int(a * b / gcd(a, b))

x = int(input())
print(int(lcm(x, 360) / x))

Solution (Python):
X=int(input())
for i in range(1,10000):
    if (i*X)%360==0:
        print(i)
        break

Solution (Python):
x=int(input())
for i in range(1,361):
    if (x*i)%360==0:
        print(i)
        break

Solution (Python):
import math
X=int(input())
print(360*X//math.gcd(360,X)//X)

Solution (Python):
X=int(input())

count=1

while True:
  if X*count%360==0:
    break
  else:
    count=count+1

print(count)

Solution (Python):
from math import gcd
x = int(input())
print(360 // gcd(360, x))

Solution (Python):
x = int(input())
k = 1
while(True):
  if k * x % 360 == 0:
    print(k)
    break
  else:
    k += 1

Solution (Python):
def main():
    x = int(input())
    theta = 360
    k = 0

    while True:
        if theta % x == 0:
            k = theta // x
            break
        theta += 360

    print(k)


if __name__ == "__main__":
    main()

Solution (Python):
import math
n=int(input())
ans=0
count=0
while True:
  if ans!=0 and ans%360==0:
    break
  else:
    count+=1
    ans+=n
print(count)

Solution (Python):
x = int(input())
for i in range(1,361):
    if x*i%360 == 0:
        print(i)
        break

Solution (Python):
x=int(input())
ans=0
i=1
while (x*i)%360!=0:
  i+=1
print(i)

Solution (Python):
from math import gcd
X = int(input())
lcm = X * 360 // gcd(X, 360)
print(lcm//X)

Solution (Python):
n = int(input())
for k in range(1,400):
  if n*k%360 == 0:
    print(k)
    break

Solution (Python):
x = int(input())
for i in range(1, 361):
    if x * i % 360 == 0:
        print(i)
        exit()

Solution (Python):
import sys

def lcm(a, b):
    a, b = max(a, b), min(a, b)
    c = a * b
    while a % b > 0:
        a, b = b, a % b
    return c // b


def solve():
    input = sys.stdin.readline
    X = int(input())
    L = lcm(360, X)
    print(L // X)

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
import math
print([ ( int(x) * 360 // math.gcd(int(x),360) ) // int(x) for x in input().split(' ') ][0])

Solution (Python):
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,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7

    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    x=I()
    print(360//gcd(360,x))


                
    
    
    
            
if __name__=="__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.buffer.readline




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()))



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()

Solution (Python):
n=int(input())
x=n
c=1
while(x%360):
    x+=n
    x%=360
    c+=1
print(c)

Solution (Python):
X = int(input())
cur = X
cnt = 1
while cur % 360:
    cur += X
    cur %= 360
    cnt += 1
print(cnt)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re












import sys
sys.setrecursionlimit(10000000)


mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x = I()
xgcd = gcd(x,360)
xlcm = 360 * x // xgcd
print(xlcm//x)

Solution (Python):
X = int(input())
T = 0
ans = 0
while (1):
  T = (T+X)%360
  ans += 1
  if (T == 0):
    break
print(ans)

Solution (Python):
X = int(input())

for x in range(1, 361):
    if x * X % 360 == 0:
        print(x)
        exit()

Solution (Python):
X = int(input())

for i in range(1,361):
    if (360*i)%X==0:
        ans=(360*i)//X
        break
print(ans)

Solution (Python):
x = int(input())
i = 1
while(1):
    if (x*i)%360 == 0:
        break 
    i += 1
print(i)

Solution (Python):
X = int(input())
t = X
ans = 1
while t%360 != 0:
    t += X
    ans += 1
print(ans)

Solution (Python):
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
X = int(input())
a = gcd(X,360)
Y = (X//a)*360
print(Y//X)

Solution (Python):
import math
n = int(input())
print(n // math.gcd(n, 360) * 360 // n)

Solution (Python):
import math
x = int(input())
print(((x*360)//math.gcd(x,360))//x)

Solution (Python):
x = int(input())
a = 360
for _ in range(360):
    if a%x == 0:
        print(a//x)
        break
    else:
        a += 360

Solution (Python):
import sys
import math
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))

n = ini()
count = n
ans = 1
while count != 0:
    count = (count + n) % 360
    ans += 1
print(ans)

Solution (Python):
import math
X=int(input())
print(360//math.gcd(360, X))

Solution (Python):
x = int(input())

for k in range(1, 361):
    n = k*x/360
    if n%1 ==0:
        break
print(k)

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

x=int(input())
print(360//(gcd(360,x)))

Solution (Python):
x=int(input())
t=0
i=1
while True:
    t+=x
    t%=360
    if t==0:
        print(i)
        break
    i+=1

Solution (Python):
x = int(input())
for i in range(1,1000000):
  if (i * x) % 360 == 0:
    print(i)
    exit()

Solution (Python):
x = int(input())
for i in range(1, 361):
    if x*i % 360 == 0:
        print(i)
        exit()

Solution (Python):
from math import gcd
x=int(input())
print(360//gcd(x,360))

Solution (Python):
X=int(input())
a=[]
for i in range(1,X+1):
    a.append(360*i)
for k in range(len(a)):
    if a[k]%X==0:
        print(int(a[k]//X))
        break

Solution (Python):
X=int(input())
i=1

while True:
  if X*i%360==0:
    print(i)
    break
  i+=1

Solution (Python):
import math

x = int(input())
if 360 % x == 0:
    print(360 // x)
else:
    common = 360 * x // math.gcd(360, x)
    ans = common // x
    print(ans)

Solution (Python):
X = int(input())
K = 0
while ((X * K) % 360 != 0) or (K == 0):
  K += 1
print(K)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

X = int(input())
from math import gcd
print(360*X//gcd(360, X)//X)

Solution (Python):
x=int(input())
X=x
k=1
while X%360!=0:
    k+=1
    X+=x
print(k)

Solution (Python):
N = int(input())
k = 1
while True:
  if k*N%360==0:
    print(k)
    exit()
  else:
    k+=1

Solution (Python):
import numpy as np
 
X = int(input())
X_lcm = np.lcm(360, X)
print(X_lcm // X)

Solution (Python):
from sys import stdin

input = stdin.readline

def main():
    X = int(input().rstrip())
    ans = 1
    n = X
    while(n % 360 != 0):
        n += X
        ans += 1 
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
x = int(input())
y = x
while y % 360:
    y += x
print(y//x)

Solution (Python):
x = int(input())
for i in range(1,361):
  if x*i%360 == 0:
    print(i)
    exit()

Solution (Python):
a = int(input())
n = 1
while True:
  if a*n % 360 == 0:
    break
  else:
    n += 1
print(n)

Solution (Python):
a=int(input())
x = 0
i = 0
while(1):
  x += a
  i += 1
  x %= 360
  if x:
    continue
  else:
    print(i)
    quit()

Solution (Python):
from math import gcd
x = int(input())
print(360 // gcd(360, x))

Solution (Python):
X = int(input())

cnt = 0
x = 0
while True:
    x += X
    cnt += 1
    if x % 360 == 0:
        print(cnt)
        exit()

Solution (Python):
x = int(input())

idx = 0
tmp = 0
while 1:
    tmp += x
    idx += 1
    if tmp % 360 == 0:
        break

print(idx)

Solution (Python):

moji=[]
moji.append("eraser")
moji.append("erase")
moji.append("dreamer")
moji.append("dream")
user = "erasedream"
user = int(input())
result = user
count = 1

while result != 0:
    result += user
    result %= 360
    count += 1
print(count,end="")

Solution (Python):
X=int(input())

for i in range(1,180):
    if (i*360%X==0):
        print((i*360)//X)
        exit()

Solution (Python):
import math
X = int(input())
print(360 // math.gcd(360, X))

Solution (Python):
import math

a = int(input())

print(int(360*a/math.gcd(360,a)/a))

Solution (Python):
import math
X = int(input())

print(360 // math.gcd(360, X))

Solution (Python):
import math
X = int(input())
lcm = 360 * X // math.gcd(360, X)
print(lcm // X)

Solution (Python):
X = int(input())
i = 1
while i <= 360:
  if i * X % 360 == 0:
    print(i)
    break
  else:
    i += 1

Solution (Python):
X = int(input())
ans = 0
W = 360
while(True):
    W -= X
    ans += 1
    if W == 0:
        break
    if W < 0:
        W += 360
print(ans)

Solution (Python):
X = int(input())
n = 2
k = 0

k = 360//X
while(360*(n-1) % X != 0):
    k = (360*n)//X
    n += 1

print(k)

Solution (Python):
import sys

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


for line in sys.stdin:
    line = line.strip()
    if line == "":
        break

    X = int(line)
    ans = 360 // gcd(X, 360)
    print(ans)

Solution (Python):
x = int(input())
for i in range(1,361):
  if x*i % 360 == 0:
    print(i)
    exit()

Solution (Python):
from math import gcd
x = int(input())

lcm = (x * 360)/gcd(x, 360)
print(int(lcm/x))

Solution (Python):
def a():
    x = int(input())
    k = 1
    while (k * x) % 360 != 0:
        k += 1
    print(k)


a()

Solution (Python):
x = int(input())
y = 360
while y % x != 0:
  y += 360
print(y // x)

Solution (Python):
def main():
    X = int(input())
    i = 1
    while True:
        if i * X % 360 == 0:
            print(i)
            break
        i += 1
main()

Solution (Python):
import sys

X = int(input())

n = 1
while True:
    if 360 * n % X == 0:
        print(360 * n // X)
        break
    n += 1

Solution (Python):
x = int(input())

n=1

while 1:
    angle_n = 360*n
    if angle_n % x == 0:
        ans = angle_n // x
        break
    else:
        n += 1

print(ans)

Solution (Python):
x=int(input())

i=1
while i*x%360!=0:
    i+=1
print(i)

Solution (Python):
import math
arg = int(input())

where = [0, 0, 0]
counter = 0
while where != [0,0,0] or counter == 0:
  
  math.sin(math.radians(30))
  where[0] += where[0]*math.sin(math.radians(where[2]))
  where[1] += where[1]*math.cos(math.radians(where[2]))
  where[2] = (where[2]+arg)%360
  
  counter += 1

print(counter)

Solution (Python):
x = int(input())
n = 1
while 360 * n % x != 0:
    n += 1
print(n * 360 // x)

Solution (Python):
x = int(input())
ans = 1
theta = x

while theta != 0:
	ans += 1
	theta = (theta + x) % 360
	
print(ans)

Solution (Python):

import math
import numpy as np


x = int(input())

for i in range(1,10**5):
    if (i*x)%360==0:
        print(i)
        break

Solution (Python):







def main():
    x = int(input())
    k = 1
    while ( x * k ) % 360:
        k += 1
    print(k)
    return

if __name__ == "__main__":
    main()

Solution (Python):
def main2():
    x = int(input())

    k = 1
    while x*k % 360 != 0:
        k += 1

    print(k)

if __name__ == "__main__":
    main2()

Solution (Python):
import math
def main():
    d = int(input())
    th = 90

    eps = 10**(-12)
    x = y = ans = 0
    while True:
        x += math.cos(math.radians(th))
        y += math.sin(math.radians(th))
        ans += 1

        if abs(x) <= eps and abs(y) <= eps:
            print(ans)
            break
        else:
            th += d

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
for i in range(1, 180, 1):
  if(360*i % n == 0):
    print(int(360*i//n))
    exit(0)

Solution (Python):
n = int(input())


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


print((360 * n // gcd(360, n)) // n)

Solution (Python):
import math
N= int(input())
if 360%N==0:
  print(int(360/N))
elif 360%N!=0:
  a = math.gcd(360,N)
  print(int(360/a))

Solution (Python):
from math import *

X=int(input())
print(360//gcd(360,X))

Solution (Python):
X=int(input())
i=1
a=0
while True:
  a=a+X
  if a%360==0:
    print(i)
    break
  i+=1

Solution (Python):
x=int(input())
if 360%x == 0:
    print(int(360/x)) 
else:
    count_2 = 0
    count_3 = 0
    count_5 = 0
    while x % 2 == 0:
        count_2 += 1
        x /= 2
        if count_2 == 3:
            break
    while x % 3 == 0:
        count_3 += 1
        x /= 3
        if count_3 == 2:
            break
    while x % 5 == 0:
        count_5 += 1
        x /= 5
        if count_5 == 1:
            break
    print((2**(3-count_2))*(3**(2-count_3))*(5**(1-count_5)))

Solution (Python):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    d = int(input())
    d = math.radians(d)
    x = 0
    y = 1
    cnt = 1
    while True:
        if abs(x)<=0.001 and abs(y) <=0.001:
            print(cnt)
            exit()
        x -= math.sin(d*cnt)
        y += math.cos(d*cnt)
        cnt += 1

if __name__=="__main__":
    main()

Solution (Python):
import math
print(360//math.gcd(int(input()),360))

Solution (Python):
import math
n=int(input())
print(360//math.gcd(n,360))

Solution (Python):
import math
n=int(input())
print(int(n*360/math.gcd(n,360)/n))

Solution (Python):
import math
n=int(input())
a=360/n
b=a-360//n
print(int(n*360/math.gcd(n,360)/n))

Solution (Python):
n=int(input())

for i in range(1,361):
  if (n*i)%360==0:
    print(i);exit()

Solution (Python):
import math

X = int(input())
print(int(360 / math.gcd(360, X)))

Solution (Python):
X=int(input())
K=0
a=0
while True:
  a+=X
  K+=1
  if a%360==0:
    break
print(K)

Solution (Python):
X = int(input())
K = 1

while K > 0:
  if X * K % 360 == 0:
    print(K)
    break
  else:
    K += 1

Solution (Python):
x=int(input())
if(360%x==0):
    print(int(360/x))
elif(360%(180-x)==0):
    print(int(360/(180-x)))
else:
    m=2
    while(1):
        if((360*m)%x==0):
            print(int(360*m/x))
            break
        elif((360*m)%(180-x)==0):
            print(int(360*m/(180-x)))
            break
        m+=1

Solution (Python):
from fractions import gcd

def main():
    x = int(input())
    a = gcd(360,x)
    print(360//a)

if __name__ == "__main__":
    main()

Solution (Python):
X=int(input())
import math
a=360*X//math.gcd(360,X)
print(a//X)

Solution (Python):
def gcd(a,b):
  if a == 0:
    return b
  return gcd(b % a, a)
    
x=int(input())
print(360//gcd(x,360))

Solution (Python):
x = int(input())
mul = 1
while (mul*360) % x != 0:
  mul += 1
print(mul*360//x)

Solution (Python):
from math import gcd
s = int(input())
print(360//gcd(360,s))

Solution (Python):
import math
X = int(input())
g = math.gcd(360, X)
l = X*360//g
print(l // X)

Solution (Python):
import sys
input = sys.stdin.readline


x = int(input())

k = 0
for i in range(1,10000):
    if x*i%360 == 0:
        k = i
        break
print(k)

Solution (Python):
n=int(input())
dx = n
ans = 1
while dx%360>0:
  ans+=1
  dx += n
print(ans)

Solution (Python):
import math

n=int(input())
a=int(n*360/math.gcd(n,360))
if n==360:
    print(1)
else:
    print(int(a/n))

Solution (Python):
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    X = int(readline())
    print(360//math.gcd(360,X))


if __name__ == '__main__':
    main()

Solution (Python):

x=int(input())
a=360
b=x
r=a%b
while r!=0:
  a=b
  b=r
  r=a%b
lcm=x*360/b
k=int(lcm/x)
print(k)

Solution (Python):
import math
X = int(input())
print(360 // math.gcd(X, 360))

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

X = int(input())
LCM = X*360/gcd(360, X)
print(int(LCM/X))

Solution (Python):
import math
X = int(input())
print(360 // math.gcd(360, X))

Solution (Python):
from math import gcd
print(360//gcd(360,int(input())))

Solution (Python):
x=int(input())
i=1
while x*i%360!=0:
  i+=1
print(i)

Solution (Python):
n=int(input())
for i in range(1,361):
    if (i*n)%360==0:
        print(i)
        break

Solution (Python):
import math
x = int(input())
print(360 // math.gcd(360, x))

Solution (Python):
import math
x = int(input())

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

print(lcm(x, 360)//x)

Solution (Python):
a = int(input())
x = a
while x%360:
 x += a
print(x//a)

Solution (Python):
x=int(input())
i=0
while True:
  360*i%x!=0
  i+=1
  if 360*i%x==0:
    break
k=360*i/x
print(int(k))

Solution (Python):
X = int(input())

for i in range(1, 361):
    if X*i % 360 == 0:
        print(i)
        exit()

Solution (Python):
X = int(input())

ans = 1
for i in range(1, 361):
    if X*i % 360 == 0:
        print(i)
        exit()

Solution (Python):
from math import gcd

def lcm(a, b):
    return a * b / gcd(a, b)    

x = int(input())
ans = int(lcm(360, x) // x)
print(ans)

Solution (Python):
from math import gcd
from sys import stdin
N = int(stdin.readline().rstrip())
print(360//gcd(N, 360))

Solution (Python):
x=int(input())
a=1
while True:

    if (a*x%360==0):
       print(a)
       break
    a+=1

Solution (Python):
x=int(input())
k=1
while True:

    if (k*x%360==0):
       print(k)
       break
    k+=1

Solution (Python):
X = int(input())

K = 1
d = X
while d % 360 != 0:
    d += X
    K += 1
print(K)

Solution (Python):
import math
import sys
from collections import Counter
import bisect
readline = sys.stdin.readline


def main():
    cnt = 0
    arg = 0
    x = int(readline().rstrip())
    for i in range(1000):
        cnt += 1
        arg += x
        arg %= 360
        if arg == 0:
            break
    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    X = int(input())

    ans = 0
    angle = 0
    while True:
        angle += X
        ans += 1
        if angle % 360 == 0:
            break
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
X=int(input())
ans=1
while True:
  if ans*X%360==0:
    print(ans)
    break
  ans+=1

Solution (Python):
x = int(input())
n = 1
while True:
  if (x * n) % 360 == 0:
    print(n)
    exit(0)
  n += 1

Solution (Python):
x = int(input())

ans = 0

while True:
    ans += 1
    if ans*x % 360 == 0:
        break

print(ans)

Solution (Python):
X = int(input())

K = 1
while True:
    if K * X % 360 == 0:
        break
    K += 1
print(K)

Solution (Python):
X = int(input())

for i in range(1, 360*X+1):
    if((360*i)%X == 0):
        print((360*i)//X)
        break

Solution (Python):
from math import gcd
x = int(input())
print(360*(x//gcd(x,360))//x)

Solution (Python):
X = int(input())

k = 1
while not (k*X)%360 == 0:
    k += 1
print(k)

Solution (Python):
x = int(input())
b = x
a = 1
while b%360!=0:
    a += 1
    b += x
print(a)

Solution (Python):
def main():
    X = int(input())
    k = 1
    while k*X % 360 != 0:
        k += 1
    print(k)


if __name__ == '__main__':
    main()

Solution (Python):
x=int(input())
for i in range(1,x+1):
    if 360*i%x==0:
        print(360*i//x)
        exit()

Solution (Python):
X = int(input())
i = 1

while (360*i) % X != 0:
  i += 1
ans = 360*i//X
print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x = int(readline())

    for i in range(1, 361):
        if (x * i) % 360 == 0:
            return print(i)


if __name__ == '__main__':
    main()

Solution (Python):
def GCD(a: int, b: int) -> int:
    return a if b == 0 else GCD(b, a % b)


def LCM(a: int, b: int) -> int:
    return a * b // GCD(a, b)


x = int(input())
ans = LCM(x, 360) // x
print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    x = I()

    g = math.gcd(x, 360)

    return 360 // g


print(main())

Solution (Python):
N=int(input())
import math
print(360//math.gcd(360,N))

Solution (Python):
n = int(input())
if 360%n:
    print(360//(360%n)*(360//n))
else:
    print(360//n)

Solution (Python):
X = int(input())
P = 360
ans = 1
x = X
while x%P != 0:
    ans += 1
    x += X
print(ans)

Solution (Python):
x=int(input())
i=0
ans=0
while(True):
    i+=x
    ans+=1
    if(i%360==0):
        print(ans)
        break

Solution (Python):
X = int(input())
cnt = 1
deg = X
while deg%360!=0:
    deg += X 
    cnt += 1
print(cnt)

Solution (Python):
X = int(input())
i = 1
while True:
    if (X * i) % 360 == 0:
        break
    i += 1
print(i)

Solution (Python):
N = int(input())
pi = 360
while True:
  if pi % N == 0:
    print(pi//N)
    exit()
  else:
    pi+=360

Solution (Python):
X = int(input())
tmp = 360
while True:
    if tmp % X == 0:
        print(tmp//X)
        exit()
    else:
        tmp+= 360

Solution (Python):
X = int(input())
tmp = 360
while True:
    if tmp % X == 0:
        print(tmp//X)
        exit()
    else:
        tmp+= 360

Solution (Python):
x = int(input())
i = 1
while (360 * i) % x != 0:
  i += 1
ans = (360 * i) // x
print(ans)

Solution (Python):
import math
print(int(360 / math.gcd(int(input()), 360)))

Solution (Python):
import math

def lcm(a, b):
    return int(a * b / math.gcd(a, b))

X = int(input())
print(int(lcm(X, 360) / X))

Solution (Python):

import math
 
def lcm(x, y):
   if x > y:
       z = x
   else:
       z = y
 
   while(True):
       if((z % x == 0) and (z % y == 0)):
           lcm = z
           break
       z += 1
 
   return lcm

X = int(input())
print(int(lcm(X, 360) / X))

Solution (Python):

import math

def squaredDistance(a, b):
  return (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2


angle = 90
X = int(input())
iter = 0
current = [0, 0]
previous = current

while (iter == 0 or squaredDistance(current, [0, 0]) > 0.00001):
  if (iter > 500):
    break

  dir = [math.cos(math.radians(angle)), math.sin(math.radians(angle))]
  current = [current[0] + dir[0], current[1] + dir[1]]
  angle = (angle + X) % 360
  
  previous = current
  iter = iter + 1

  

print(iter)

Solution (Python):
import math
x=int(input())
if 360%x==0:
    print(360//x)
else:
    print(360 // math.gcd(x, 360))

Solution (Python):
x=int(input(""))
import math
a=math.gcd(360,x)
print(int(360/a))

Solution (Python):
x = int(input())
b = x
t = 1
 
while b % 360 != 0:
    b += x
    t += 1
 
print(t)

Solution (Python):
x = int(input())
b = x
t = 1

while b % 360 != 0:
    b += x
    t += 1

print(t)

Solution (Python):
x = int(input())
i = 1
val = x
while val % 360 != 0:
  val += x
  i += 1
print(i)

Solution (Python):
n=int(input())
k=1
while k>0:
  if k*n%360==0:
       print(k)
       break
  else:
       k+=1

Solution (Python):
n=int(input())
for i in range(1,361):
  if n*i%360==0:
    ans=i
    break
print(ans)

Solution (Python):
n=int(input())
from math import gcd
m=gcd(360,n)
print(360//m)

Solution (Python):
x = int(input())
c = 0
n = x
while(True):
    if n%360 == 0:
        c+=1
        break
    c+=1
    n+=x
print(c)

Solution (Python):
import sys
X = int(input())

for i in range(1,180):
  if int(360*i/X) == 360*i/X:
    print(int(360*i/X))
    sys.exit()

Solution (Python):
X = int(input())

ans = 1

while (X*ans)%360 != 0:
    ans += 1
print(ans)

Solution (Python):
def lcm(a, b):
    from math import gcd
    return a * b // gcd(a, b) 
print(lcm(360, n := int(input())) // n)

Solution (Python):
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
x=int(input())
y=lcm(x,360)
print(y//x)