#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long ships = 0;
  while (a != 0 && b != 0) {
    if (b > a) {
      ships += b / a;
      b = b % a;
    } else {
      ships += a / b;
      a = a % b;
    }
  }
  cout << ships << endl;
  return 0;
}
