threebuf = new Array(18);
cnt = 0;
C3 = eval(C);
if (C3 < 3) threebuf[0] = C3;
else{
	while(1) {
		threeval = C3 % 3;
		C3 = Math.floor(C3/3);
		
		threebuf[cnt] = threeval;
		cnt++;
		
		if (C3 < 3){
		threebuf[cnt] = C3;
			break;
		}
	}
}

for (i=0; i<=cnt; i++) document.write(threebuf[cnt-i]);
