import std; void main() { int X; readf("%d\n", X); int[] A = [2, 2, -1, -1, 2, -1, -1]; auto B = A.cycle(100); int res, pos; foreach (b; B) { pos += b; res += b.abs; if (pos == X) break; } res.writeln; }