Polygon for the Angle

题意翻译

## Description 给定一个角度 $\theta$,请你寻找一个正 $n$ 边型,满足在这个正 $n$ 边型上找三个顶点 $A,B,C$ (可以不相邻),使得 $\angle ABC~=~\theta$ 。请输出最小的 $n$。保证 $n$ 不超过 $998244353$。多组数据。 注意给出的 $\theta$ 是使用角度制表示的。 ## Input 第一行是数据组数 $T$ 下面 $T$ 行,每行一个整数 $\theta$,代表给出的角度 ## Output 对于每组数据输出一行代表答案 ## Hint $1~\leq~T~\leq~180~,~1~\leq~\theta~<~180$。 translated by @一扶苏一

题目描述

You are given an angle $ \text{ang} $ . The Jury asks You to find such regular $ n $ -gon (regular polygon with $ n $ vertices) that it has three vertices $ a $ , $ b $ and $ c $ (they can be non-consecutive) with $ \angle{abc} = \text{ang} $ or report that there is no such $ n $ -gon. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1096C/a07369ed7e451bdcca3873a15baacc5b09a55799.png)If there are several answers, print the minimal one. It is guarantied that if answer exists then it doesn't exceed $ 998244353 $ .

输入输出格式

输入格式


The first line contains single integer $ T $ ( $ 1 \le T \le 180 $ ) — the number of queries. Each of the next $ T $ lines contains one integer $ \text{ang} $ ( $ 1 \le \text{ang} < 180 $ ) — the angle measured in degrees.

输出格式


For each query print single integer $ n $ ( $ 3 \le n \le 998244353 $ ) — minimal possible number of vertices in the regular $ n $ -gon or $ -1 $ if there is no such $ n $ .

输入输出样例

输入样例 #1

4
54
50
2
178

输出样例 #1

10
18
90
180

说明

The answer for the first query is on the picture above. The answer for the second query is reached on a regular $ 18 $ -gon. For example, $ \angle{v_2 v_1 v_6} = 50^{\circ} $ . The example angle for the third query is $ \angle{v_{11} v_{10} v_{12}} = 2^{\circ} $ . In the fourth query, minimal possible $ n $ is $ 180 $ (not $ 90 $ ).