#include<stdio.h>

#define N 4

void Nshinsu(int);

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

void Nshinsu(int n){

  int i,y=0,b=1;

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

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