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)

6e821e2455f532c318a28e41c19ddbe9cb7b6ee9
<mask token>

<mask token>
while 1:
    angle_n = 360 * n
    if angle_n % x == 0:
        ans = angle_n // x
        break
    else:
        n += 1
print(ans)

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)
