#include using namespace std; vector a = {2, 2, -1, -1, 2, -1, -1}; int main(){ int X; cin >> X; int p = 0, t = 0; int d = 0; while (true){ d += abs(a[t % 7]); p += a[t % 7]; t++; if (X == p){ cout << d << endl; break; } } }