#include <iostream>
using namespace std;

int main(){
  int a,b,cou;
  while(1){
    cin >>a;
    if(a==-1)break;
    b=4;
    for(b=4;b<a;b=b*4);
    b=b/4;
    while(1){
      cout<< a/b;
      a%=b;
      if(b==1)break;
      b=b/4;
    }
    cout << endl;
  }
  return 0;

}