
fun main(args: Array<String>) {
    val x = getInt()
    val l = lcm(x, 360)
    println(l / x)

}

fun gcd(a: Int, b: Int): Int {
    return if (a % b == 0) b else gcd(b, a % b)
}

fun lcm(a: Int, b: Int): Int {
    return a * b / gcd(a, b)
}

fun getInt() = readLine()!!.toInt()