output_description: Print the number of times Takahashi will do the action before he is at the
  starting position again.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      X
attempt: from sys import stdin
  
  
  # , setrecursionlimit, stdout
  # setrecursionlimit(1000000)
  # from collections import deque
  # from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
  # from heapq import heapify, heappop, heappush, heappushpop, heapreplace
  def ii():
      return int(stdin.readline())
  
  
  def fi():
      return float(stdin.readline())
  
  
  def mi():
      return map(int, stdin.readline().split())
  
  
  def fmi():
      return map(float, stdin.readline().split())
  
  
  def li():
      return list(mi())
  
  
  def si():
      return stdin.readline().rstrip()
  
  
  def lsi():
      return list(si())
  
  
  mod = 1000000007
  res = ["YES", "NO"]
  
  
  # \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
  #############\\\\\\\\\\\\\ CODE STARTS HERE /////////////#############
  # ////////////////////////////////////////////////////////////////////#
  
  
  def bin_search(a, val):
      pos, l, r = 0, 0, len(a) - 1
      while l <= r:
          m = (l + r) // 2
          x = (180 * (a[m] - 2)) / a[m]
          if x == val:
              return a[m]
          if x < val:
              pos = m + 1
              l = m + 1
          else:
              r = m - 1
      return pos
  
  
  test_case = 1
  while test_case:
      test_case -= 1
  
      x = ii()
      ans = bin_search([i for i in range(3, 364)], 180 - x)
      if not ans:
          ans = bin_search([i for i in range(3, 364)], x)
      print(ans)
  
problem_description: Statement
  
  Takahashi is standing on a two-dimensional plane, facing north. Find the
  minimum positive integer K such that Takahashi will be at the starting
  position again after he does the following action K times:
  
    * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
samples: [{"input": "90", "output": "4\n    \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]