object Main extends App {
  @scala.annotation.tailrec
  def gcd(x: Int, y: Int): Int = if (y == 0) x else gcd(y, x % y)

  val sc = new java.util.Scanner(System.in)
  val X = sc.nextInt()
  println(360 / gcd(X, 360))
}
