#include<stdio.h>

void yonshinsu(int);

int main(){
  while(1){
    int n;
    scanf("%d",&n);
    if(n==-1)break;
    yonshinsu(n);
  }
  return 0;
}

void yonshinsu(int n){

  int i,m,y=0,b=1;

  for(i=0;i<10;i++){    
    y+=(n%4)*b;
    n/=4;
    b*=10;
  }

  printf("%d\n",y);
}