
fun main() {
    val x = readLine()!!.toInt()
    var ans = 0
    var k = 1
    while(true) {
        val v = 360 * k
        if(v % x == 0) {
            ans = v / x
            break
        }
        ++k
    }
    print(ans)
}