fun main() {
    val builder = StringBuilder()

    val x = readInputLine().toLong()

    val gcd = gcd(x, 360L)

    builder.appendln(x * 360L / gcd / x)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}

tailrec fun gcd(a: Long, b: Long): Long =
    when {
        b > a -> gcd(b, a)
        b == 0L -> a
        else -> gcd(b, a % b)
    }
