a[181],m1[1000000],m2[1000000],T;
int s(p,n,d,c,f){
	int *m=p;
	if(!n)return 0;
	if(m[n]<1000000)return m[n];
	for(;d;d--){
		if(a[d]>n||(f&&!(a[d]&1)))continue;
		T=s(p,n%a[d],d-1,c+n/a[d],f)+n/a[d];
		if(m[n]>T)m[n]=T;
	}
	return m[n];
}

//#define R(s,i)for(i=s;i<181;i++)
//#define Z(e,n)if(e>1000000)break;if(b[e]>n)b[e]=n;
//b[1000000];
main(n){
	for(n=1;n<181;n++)a[n]=n*(n+1)*(n+2)/6;
	memset(m1,99,sizeof(m1));
	memset(m2,99,sizeof(m2));
/*
	memset(b,99,sizeof(b));
	R(1,i){
		Z(a[i],1)R(i,j){
			Z(a[i]+a[j],2)R(j,k){
				Z(a[i]+a[j]+a[k],3)R(k,l){
					Z(a[i]+a[j]+a[k]+a[l],4)R(l,m){
printf("%d %d %d %d %d\n",i,j,k,l,m);
						Z(a[i]+a[j]+a[k]+a[l]+a[m],5)
					}
				}
			}
		}
	}
*/
	for(;scanf("%d",&n),n;)printf("%d %d\n",s(m1,n,180,0,0),s(m2,n,180,0,1));
exit(0);
}