#include <iostream>
// Recycling 7 cups can get 1 cup
int calculate(int x)
{
if (x < 7) {
return x;
} else {
return x - (x % 7) + calculate(x % 7 + x / 7);
}
}
int main()
{
int n; // buy cup(s)
std::cin >> n;
std::cout << calculate(n) << std::endl;
}