#include using namespace std; typedef long long ll; const int N=1e6+2; int a[N],b[N]; ll ans; string a_s; int div(string &a_s,int k) { int len,r=0; len=a_s.length(); for(int i=0;i=0;i--) { r=r*10+a[i]; b[i]=r/k; r%=k; } while(len>0&&b[len-1]==0) len--; a_s.clear(); for(int i=0;i>a_s; while(a_s.length()) ans+=div(a_s,2); cout<