from math import gcd

print((360 //gcd(360, int(eval(input())))))

import math

print((360//math.gcd(360,int(eval(input())))))
from math import gcd

print((360 // gcd(360, int(eval(input())))))

import math

print((360 // math.gcd(360, int(eval(input())))))

-from math import gcd +import math -print((360 // gcd(360, int(eval(input()))))) +print((360 // math.gcd(360, int(eval(input())))))