#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, i, ans = 0, x, y, temp = 0;
  cin >> a >> b;
  if (a > b) {
    x = a;
    y = b;
  } else {
    x = b;
    y = a;
  }
  for (i = 0;; i++) {
    ans = ans + (x / y);
    if (x % y == 0) break;
    temp = x;
    x = y;
    y = temp % y;
  }
  cout << ans;
  return 0;
}
