import Foundation

let X = Int(readLine()!)!

var posi = 0
var result = 0

while true {
    result += 1
    posi += X

    if posi > 360 {
        posi -= 360
    }
    
    if posi == 360 { break }
}

print(result)