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