import Foundation
var r = Int(readLine()!)!
var i=0,j=0,v=0

if 360 % r == 0 {
    print(360/r)
}else{
    i = 180 - r
    if 360 % i == 0 {
     print(360/i)
    }else{
        while true {
            j+=1
            v+=r
            if r % 360 == 0 {
                print(j)
                break
            }
        }
    
}
}