def gcd(x,y):

    while y>0:

        x,y = y,x%y

    return x

X = int(eval(input()))

a = gcd(X,360)

Y = (X//a)*360

print((Y//X))
def gcd(x,y):

    while y>0:

        x,y = y,x%y

    return x

X = int(eval(input()))

a = gcd(360,X)

b = (X//a)*360

print((b//X))
def gcd(x, y):
    while y > 0:
        x, y = y, x % y
    return x


X = int(eval(input()))
a = gcd(X, 360)
Y = (X // a) * 360
print((Y // X))

def gcd(x, y):
    while y > 0:
        x, y = y, x % y
    return x


X = int(eval(input()))
a = gcd(360, X)
b = (X // a) * 360
print((b // X))

-a = gcd(X, 360) -Y = (X // a) * 360 -print((Y // X)) +a = gcd(360, X) +b = (X // a) * 360 +print((b // X))