using namespace std; int n,ans; int main(){ cin>>n; ans=n; while(n>2){ ans+=n/3; n=n/3+n%3; } cout<<ans; }