/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	AtCoder::Num num = data->getNum();

	const int n = num[0];

	switch (n) {
	case (1):
		printf("%d\n", 360);
		break;
	case (2):
		printf("%d\n", 180);
		break;
	case (3):
		printf("%d\n", 120);
		break;
	case (4):
		printf("%d\n", 90);
		break;
	case (5):
		printf("%d\n", 72);
		break;
	case (6):
		printf("%d\n", 60);
		break;
	case (7):
		printf("%d\n", 360);
		break;
	case (8):
		printf("%d\n", 45);
		break;
	case (9):
		printf("%d\n", 40);
		break;
	case (10):
		printf("%d\n", 36);
		break;
	case (11):
		printf("%d\n", 360);
		break;
	case (12):
		printf("%d\n", 30);
		break;
	case (13):
		printf("%d\n", 360);
		break;
	case (14):
		printf("%d\n", 180);
		break;
	case (15):
		printf("%d\n", 24);
		break;
	case (16):
		printf("%d\n", 45);
		break;
	case (17):
		printf("%d\n", 360);
		break;
	case (18):
		printf("%d\n", 20);
		break;
	case (19):
		printf("%d\n", 360);
		break;
	case (20):
		printf("%d\n", 18);
		break;
	case (21):
		printf("%d\n", 120);
		break;
	case (22):
		printf("%d\n", 180);
		break;
	case (23):
		printf("%d\n", 360);
		break;
	case (24):
		printf("%d\n", 15);
		break;
	case (25):
		printf("%d\n", 72);
		break;
	case (26):
		printf("%d\n", 180);
		break;
	case (27):
		printf("%d\n", 40);
		break;
	case (28):
		printf("%d\n", 90);
		break;
	case (29):
		printf("%d\n", 360);
		break;
	case (30):
		printf("%d\n", 12);
		break;
	case (31):
		printf("%d\n", 360);
		break;
	case (32):
		printf("%d\n", 45);
		break;
	case (33):
		printf("%d\n", 120);
		break;
	case (34):
		printf("%d\n", 180);
		break;
	case (35):
		printf("%d\n", 72);
		break;
	case (36):
		printf("%d\n", 10);
		break;
	case (37):
		printf("%d\n", 360);
		break;
	case (38):
		printf("%d\n", 180);
		break;
	case (39):
		printf("%d\n", 120);
		break;
	case (40):
		printf("%d\n", 9);
		break;
	case (41):
		printf("%d\n", 360);
		break;
	case (42):
		printf("%d\n", 60);
		break;
	case (43):
		printf("%d\n", 360);
		break;
	case (44):
		printf("%d\n", 90);
		break;
	case (45):
		printf("%d\n", 8);
		break;
	case (46):
		printf("%d\n", 180);
		break;
	case (47):
		printf("%d\n", 360);
		break;
	case (48):
		printf("%d\n", 15);
		break;
	case (49):
		printf("%d\n", 360);
		break;
	case (50):
		printf("%d\n", 36);
		break;
	case (51):
		printf("%d\n", 120);
		break;
	case (52):
		printf("%d\n", 90);
		break;
	case (53):
		printf("%d\n", 360);
		break;
	case (54):
		printf("%d\n", 20);
		break;
	case (55):
		printf("%d\n", 72);
		break;
	case (56):
		printf("%d\n", 45);
		break;
	case (57):
		printf("%d\n", 120);
		break;
	case (58):
		printf("%d\n", 180);
		break;
	case (59):
		printf("%d\n", 360);
		break;
	case (60):
		printf("%d\n", 6);
		break;
	case (61):
		printf("%d\n", 360);
		break;
	case (62):
		printf("%d\n", 180);
		break;
	case (63):
		printf("%d\n", 40);
		break;
	case (64):
		printf("%d\n", 45);
		break;
	case (65):
		printf("%d\n", 72);
		break;
	case (66):
		printf("%d\n", 60);
		break;
	case (67):
		printf("%d\n", 360);
		break;
	case (68):
		printf("%d\n", 90);
		break;
	case (69):
		printf("%d\n", 120);
		break;
	case (70):
		printf("%d\n", 36);
		break;
	case (71):
		printf("%d\n", 360);
		break;
	case (72):
		printf("%d\n", 5);
		break;
	case (73):
		printf("%d\n", 360);
		break;
	case (74):
		printf("%d\n", 180);
		break;
	case (75):
		printf("%d\n", 24);
		break;
	case (76):
		printf("%d\n", 90);
		break;
	case (77):
		printf("%d\n", 360);
		break;
	case (78):
		printf("%d\n", 60);
		break;
	case (79):
		printf("%d\n", 360);
		break;
	case (80):
		printf("%d\n", 9);
		break;
	case (81):
		printf("%d\n", 40);
		break;
	case (82):
		printf("%d\n", 180);
		break;
	case (83):
		printf("%d\n", 360);
		break;
	case (84):
		printf("%d\n", 30);
		break;
	case (85):
		printf("%d\n", 72);
		break;
	case (86):
		printf("%d\n", 180);
		break;
	case (87):
		printf("%d\n", 120);
		break;
	case (88):
		printf("%d\n", 45);
		break;
	case (89):
		printf("%d\n", 360);
		break;
	case (90):
		printf("%d\n", 4);
		break;
	case (91):
		printf("%d\n", 360);
		break;
	case (92):
		printf("%d\n", 90);
		break;
	case (93):
		printf("%d\n", 120);
		break;
	case (94):
		printf("%d\n", 180);
		break;
	case (95):
		printf("%d\n", 72);
		break;
	case (96):
		printf("%d\n", 15);
		break;
	case (97):
		printf("%d\n", 360);
		break;
	case (98):
		printf("%d\n", 180);
		break;
	case (99):
		printf("%d\n", 40);
		break;
	case (100):
		printf("%d\n", 18);
		break;
	case (101):
		printf("%d\n", 360);
		break;
	case (102):
		printf("%d\n", 60);
		break;
	case (103):
		printf("%d\n", 360);
		break;
	case (104):
		printf("%d\n", 45);
		break;
	case (105):
		printf("%d\n", 24);
		break;
	case (106):
		printf("%d\n", 180);
		break;
	case (107):
		printf("%d\n", 360);
		break;
	case (108):
		printf("%d\n", 10);
		break;
	case (109):
		printf("%d\n", 360);
		break;
	case (110):
		printf("%d\n", 36);
		break;
	case (111):
		printf("%d\n", 120);
		break;
	case (112):
		printf("%d\n", 45);
		break;
	case (113):
		printf("%d\n", 360);
		break;
	case (114):
		printf("%d\n", 60);
		break;
	case (115):
		printf("%d\n", 72);
		break;
	case (116):
		printf("%d\n", 90);
		break;
	case (117):
		printf("%d\n", 40);
		break;
	case (118):
		printf("%d\n", 180);
		break;
	case (119):
		printf("%d\n", 360);
		break;
	case (120):
		printf("%d\n", 3);
		break;
	case (121):
		printf("%d\n", 360);
		break;
	case (122):
		printf("%d\n", 180);
		break;
	case (123):
		printf("%d\n", 120);
		break;
	case (124):
		printf("%d\n", 90);
		break;
	case (125):
		printf("%d\n", 72);
		break;
	case (126):
		printf("%d\n", 20);
		break;
	case (127):
		printf("%d\n", 360);
		break;
	case (128):
		printf("%d\n", 45);
		break;
	case (129):
		printf("%d\n", 120);
		break;
	case (130):
		printf("%d\n", 36);
		break;
	case (131):
		printf("%d\n", 360);
		break;
	case (132):
		printf("%d\n", 30);
		break;
	case (133):
		printf("%d\n", 360);
		break;
	case (134):
		printf("%d\n", 180);
		break;
	case (135):
		printf("%d\n", 8);
		break;
	case (136):
		printf("%d\n", 45);
		break;
	case (137):
		printf("%d\n", 360);
		break;
	case (138):
		printf("%d\n", 60);
		break;
	case (139):
		printf("%d\n", 360);
		break;
	case (140):
		printf("%d\n", 18);
		break;
	case (141):
		printf("%d\n", 120);
		break;
	case (142):
		printf("%d\n", 180);
		break;
	case (143):
		printf("%d\n", 360);
		break;
	case (144):
		printf("%d\n", 5);
		break;
	case (145):
		printf("%d\n", 72);
		break;
	case (146):
		printf("%d\n", 180);
		break;
	case (147):
		printf("%d\n", 120);
		break;
	case (148):
		printf("%d\n", 90);
		break;
	case (149):
		printf("%d\n", 360);
		break;
	case (150):
		printf("%d\n", 12);
		break;
	case (151):
		printf("%d\n", 360);
		break;
	case (152):
		printf("%d\n", 45);
		break;
	case (153):
		printf("%d\n", 40);
		break;
	case (154):
		printf("%d\n", 180);
		break;
	case (155):
		printf("%d\n", 72);
		break;
	case (156):
		printf("%d\n", 30);
		break;
	case (157):
		printf("%d\n", 360);
		break;
	case (158):
		printf("%d\n", 180);
		break;
	case (159):
		printf("%d\n", 120);
		break;
	case (160):
		printf("%d\n", 9);
		break;
	case (161):
		printf("%d\n", 360);
		break;
	case (162):
		printf("%d\n", 20);
		break;
	case (163):
		printf("%d\n", 360);
		break;
	case (164):
		printf("%d\n", 90);
		break;
	case (165):
		printf("%d\n", 24);
		break;
	case (166):
		printf("%d\n", 180);
		break;
	case (167):
		printf("%d\n", 360);
		break;
	case (168):
		printf("%d\n", 15);
		break;
	case (169):
		printf("%d\n", 360);
		break;
	case (170):
		printf("%d\n", 36);
		break;
	case (171):
		printf("%d\n", 40);
		break;
	case (172):
		printf("%d\n", 90);
		break;
	case (173):
		printf("%d\n", 360);
		break;
	case (174):
		printf("%d\n", 60);
		break;
	case (175):
		printf("%d\n", 72);
		break;
	case (176):
		printf("%d\n", 45);
		break;
	case (177):
		printf("%d\n", 120);
		break;
	case (178):
		printf("%d\n", 180);
		break;
	case (179):
		printf("%d\n", 360);
		break;
	default:
		return -1;
		break;
	}

	delete(data);

	return 0;
}


Measured memory_bytes: 3160