#include <bits/stdc++.h>
using namespace std;
long int f(int a, int b) {
  if (b != 0)
    return 2 * a + f(a, a % b);
  else
    return 2 * a;
}
int main() {
  long long int A;
  for (int a = 2; a < 20; a++) {
    for (int b = 1; b < a; b++) {
      int N = a, X = b;
      A = N;
      N -= X;
      while (true) {
        if (N > X) {
          swap(N, X);
          A += (2 * (X / N) * N);
          X = X % N;
        }
        if (N == X) {
          A += 1;
          break;
        }
        if (X == 0) break;
      }
      cout << A - 1 << endl;
    }
  }
  return 0;
}
