#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  long long count = 0;
  while (cin >> a >> b) {
    long long maxn = max(a, b);
    long long minn = min(a, b);
    while (maxn > 1) {
      count += maxn / minn;
      long long temp = maxn % minn;
      if (temp) {
        maxn = minn;
        minn = temp;
      } else
        break;
    }
    cout << count << endl;
    count = 0;
  }
  return 0;
}
