#include <iostream>
int main() {
  int ans[179] = {
               360,
               180,
               120,
               90,
               72,
               60,
               360,
               45,
               40,
               36,
               360,
               30,
               360,
               180,
               24,
               45,
               360,
               20,
               360,
               18,
               120,
               180,
               360,
               15,
               72,
               180,
               40,
               90,
               360,
               12,
               360,
               45,
               120,
               180,
               72,
               10,
               360,
               180,
               120,
               9,
               360,
               60,
               360,
               90,
               8,
               180,
               360,
               15,
               360,
               36,
               120,
               90,
               360,
               20,
               72,
               45,
               120,
               180,
               360,
               6,
               360,
               180,
               40,
               45,
               72,
               60,
               360,
               90,
               120,
               36,
               360,
               5,
               360,
               180,
               24,
               90,
               360,
               60,
               360,
               9,
               40,
               180,
               360,
               30,
               72,
               180,
               120,
               45,
               360,
               4,
               360,
               90,
               120,
               180,
               72,
               15,
               360,
               180,
               40,
               18,
               360,
               60,
               360,
               45,
               24,
               180,
               360,
               10,
               360,
               36,
               120,
               45,
               360,
               60,
               72,
               90,
               40,
               180,
               360,
               3,
               360,
               180,
               120,
               90,
               72,
               20,
               360,
               45,
               120,
               36,
               360,
               30,
               360,
               180,
               8,
               45,
               360,
               60,
               360,
               18,
               120,
               180,
               360,
               5,
               72,
               180,
               120,
               90,
               360,
               12,
               360,
               45,
               40,
               180,
               72,
               30,
               360,
               180,
               120,
               9,
               360,
               20,
               360,
               90,
               24,
               180,
               360,
               15,
               360,
               36,
               40,
               90,
               360,
               60,
               72,
               45,
               120,
               180,
               360,
  };
  int X;
  std::cin >> X;
  std::cout << ans[X - 1] << "\n";
}


Measured memory_bytes: 3632