import Foundation
var r = Int(readLine()!)!
var i=0,j=0
if 360 % r == 0 {
    print(360/r)
}else{
    i = 180 - r
    if 360 % i == 0 {
        print(360/i)
    }else{
        print((360/i)*3)
 
    }
}