#include#include int n, m; long long dp[305][305], ans[305][305]; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { for (int i = 1; i <= 300; i++) for (int j = 1; j <= 300; j++) dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + (gcd(i, j) == 1); for (int i = 1; i <= 300; i++) for (int j = 1; j <= 300; j++) ans[i][j] = ans[i - 1][j] + ans[i][j - 1] - ans[i - 1][j - 1] + dp[i][j] - dp[i / 2][j / 2]; while (~scanf("%d%d", &n, &m) && n || m) { printf("%lld\n", ans[n - 1][m - 1] * 2); } return 0; }