#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
scanf("%d", &n);
int res = n, cap = n;
while (cap >= 3)
{
res += cap / 3;
cap = cap / 3 + cap % 3;
}
printf("%d", res);
return 0;
}