#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include // #include // #include // #include // #include #define int long long #define all(x) begin(x), end(x) using namespace std; // using namespace atcoder; // using mint = modint998244353; // using mint = modint1000000007; using ld = long double; using pii = pair; using vi = vector; using vvi = vector; using vvvi = vector; using vp = vector; using vvp = vector; using vs = vector; using vvc = vector>; void debug(vector a) { for (auto x : a) cout << x << ' '; cout << endl; } void debug(vector> a) { for (auto y : a) debug(y); } template inline bool chmax(T1 &a, T2 b) {return a < b and (a = b, true);} template inline bool chmin(T1 &a, T2 b) {return a > b and (a = b, true);} const int supl = LONG_LONG_MAX - 100; void main_() { int x; cin >> x; vi d = {2, 2, -1, -1, 2, -1, -1}; int now = 0; int dist = 0; for (int i = 0 ; now != x ; i++) { now += d[i % d.size()]; dist += abs(d[i % d.size()]); } cout << dist << endl; } signed main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); main_(); return 0; }