来自bjq$O(mn)$
公式来源于Mathologer某视频
import math
if __name__ == "__main__":
n, m = map(int, input().split())
while n:
ans = 1
M = int((m + 1) // 2) #代替 M = math.ceil(m / 2)
N = int((n + 1) // 2) #代替 N = math.ceil(n / 2)
for i in range(1, M+1):
for j in range(1, N+1):
a = round(math.cos(i * math.pi / (m + 1)), 30) #最小可用15
b = round(math.cos(j * math.pi / (n + 1)), 30) #同15位就够精度了
ans*= 4 * (a*a + b*b)
print(int(round(ans)))
n, m = map(int, input().split())