#include<iostream> using namespace std; int bottle,cap; int main(){ cin>>bottle; cap = bottle; while(cap>=3){ bottle += cap/3; cap = cap/3 +cap %3; } cout<<bottle<<endl; }