#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, i, j, k = 0;
  cin >> a >> b;
  j = 1;
  while (j != 0) {
    k += a / b;
    j = a % b;
    a = b;
    b = j;
  }
  cout << k << endl;
}
