fun main(args: Array<String>) {
    val x = readLine()!!.toInt()

    fun gcd(a: Int, b: Int): Int {
        return if (a==1 || b== 1) 1
        else if (b == 0) a
        else if (a < b) gcd(a, b % a)
        else gcd(b, a % b)
    }
    val gcd = gcd(x,360)
    println(360/gcd)
}
