#include using namespace std; #define all(v) (v).begin(),(v).end() #define pb emplace_back #define rep(i, n) for(int i=0;i<(n);i++) #define foa(e, v) for(auto& e : v) #define dout(a) cout< using pqr = priority_queue, greater>; template inline bool chmax(T1 &a, T2 b) { bool compare = a < b; if(compare) a = b; return compare; } template inline bool chmin(T1 &a, T2 b) { bool compare = a > b; if(compare) a = b; return compare; } template inline T back(std::set &s) { return *s.rbegin(); } template inline T back(std::multiset &s) { return *s.rbegin(); } template inline T pop_back(std::set &s) { auto it = prev(s.end()); T val = *it; s.erase(it); return val; } template inline T pop_back(std::multiset &s) { auto it = prev(s.end()); T val = *it; s.erase(it); return val; } const int dy[8] = {-1, 0, 0, 1, 1, -1, 1, -1}; const int dx[8] = {0, -1, 1, 0, -1, -1, 1, 1}; const char br = '\n'; long long modinv(long long a, long long MOD) { long long b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } u %= MOD; if (u < 0) u += MOD; return u; } void solve() { string s; cin >> s; Int a = 0; Int inf = 1000000000; Int INF = inf * inf; int id = -1; int n = s.size(); rep(i, n) { if(s[i] == '.') { id = i; break; } } if(id == -1) { a = stoi(s) * inf; } else { while((int)s.size() - id - 1 < 9) s += "0"; n = s.size(); a = ll(stoi(s.substr(0, id))) * inf + ll(stoi(s.substr(id + 1, n - (id + 1)))); } Int b = inf; int cnt = 0; while(a) { b %= a; swap(a, b); cnt ++; } cout << cnt << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); int testcase = 1; // cin >> testcase; while(testcase --) solve(); return 0; }