import math



if __name__ == "__main__":

    deg = int(eval(input()))

    print((360//math.gcd(deg, 360)))
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(eval(input()))

if 360%x == 0:

    print((int(360/x)))

else :

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

import math

if __name__ == "__main__":
    deg = int(eval(input()))
    print((360 // math.gcd(deg, 360)))

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(eval(input()))
if 360 % x == 0:
    print((int(360 / x)))
else:
    print((int(lcm(360, x) / x)))

-import math +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 -if __name__ == "__main__": -    deg = int(eval(input())) -    print((360 // math.gcd(deg, 360))) + +x = int(eval(input())) +if 360 % x == 0: +    print((int(360 / x))) +else: +    print((int(lcm(360, x) / x)))