from math import gcd



x = int(eval(input()))

y = x * 360 // gcd(x, 360)

print((y//x))
x = int(eval(input()))

y = 0

k = 0

while True:

    y += x

    k += 1

    if y % 360 == 0:

        break

print(k)
from math import gcd

x = int(eval(input()))
y = x * 360 // gcd(x, 360)
print((y // x))

x = int(eval(input()))
y = 0
k = 0
while True:
    y += x
    k += 1
    if y % 360 == 0:
        break
print(k)

-from math import gcd - -y = x * 360 // gcd(x, 360) -print((y // x)) +y = 0 +k = 0 +while True: +    y += x +    k += 1 +    if y % 360 == 0: +        break +print(k)