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