#include using namespace std; using ll = long long; using ld = long double; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++) const ll mod = 1e9 + 7; const int INF = 1e9; int main() { cin.sync_with_stdio(false); int N; cin >> N; ll k = N / 8+1; ll x = N% 8; int m[8] = {0,0,1,0,3,2,3,7}; ll ans = k*m[x]; ans += (k - 1)*(7 - x); cout << ans << endl; return 0; }