#include <iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
int cola=n;
while(n>=3)
cola+=n/3;
n=n/3+n%3;
}
if(n==2)
cola++;
cout<<cola<<endl;
return 0;