#include<bits/stdc++.h>
using namespace std;
long long n,sum;
int main(){
cin>>n;
int temp,T=n,pos=0;
while(n/3>=1){
temp=n/3;
if(temp*3!=n) temp++;
n-=temp;
sum++;
if((T-1)%3==0 && T>=0){
T=-1;
pos=sum;
}
else if(T>=0){
T-=temp;
}
}
if(T>=0){
pos=sum+T;
}
sum+=n;
cout<<sum<<" "<<pos;
}