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