Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == -1 {
			break
		}
		if n == 0 {
			fmt.Println(0)
			continue
		}
		ans := make([]int, 0)
		for n > 0 {
			ans = append([]int{n % 4}, ans...)
			n = n / 4
		}

		buf := make([]string, len(ans))
		for i := range ans {
			buf[i] = strconv.Itoa(ans[i])
		}
		fmt.Println(strings.Join(buf, ""))
	}
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n;
    while(cin>>n&&n!=-1){
        int ans=0;
        for(int i=0;;i++){
            ans+=(n%4*pow(10,i));
            if(n/4==0) break;
            n=n/4;
        }
        cout<<ans<<endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int z[2002], x, kai, m, bai,i;
	kai = 0;
	while (1) {
		cin >> x;
		if (x == -1) {
			goto a;
		}
		kai = kai + 1;
		bai = 1;
		z[kai] = 0;
		while (x!=0) {
			m = x % 4;
			x = (x - m)/4;
			if (bai == 1) {
				z[kai] = m;
			}else {
				z[kai] = z[kai] + m * bai;
			}
			bai = bai * 10;
		}
	}
a:;
	cout << endl;
	for (i = 1; i <= kai; i++) {
		cout << z[i] << endl;
	}
}

C++: #include<stdio.h>
int main(void)
{
    int a,b,c,d,f[20];
		scanf("%d",&a);
		while(a!=-1){
		    d=0;
			while(1){
				b=a/4;
				c=a%4;
				f[d]=c;
				a=b;
				d++;
				if(a<4) {
					f[d]=a;
					break;
				}
			}
			if(f[d]==0) d=d-1;
			for(d;d>=0;d--){
				printf("%d",f[d]);
			}
			printf("\n");
			scanf("%d",&a);
		}
		return 0;
}

C++: #include <iostream>
using namespace std;

int jou(int x,int y){
  int ans = 1,i;

  for(i = 0;i < y;i++){
    if(y != 0) ans *= x;
  }
  if(y == 0) ans = 1;
  return ans;
}


int main(){
  int qu,i = 0,keta = 0,a,n;
  int bin[999];

  cin >> n;

  int sum = n;
  //keta
  while(1){
    if(n < 4 )break;
    keta++;   
     n /= 4;
  }

  keta ++;
  // cout << "keta = " << keta << endl;

  for(int i = keta - 1;i > 0;i--){
    bin[i] = sum / jou(4,i);
    // cout << "bin[i] = " << bin[i] << "jou(4,1) = " << jou(4,i) << endl;
    sum = sum - jou(4,i) * bin[i];
  }

  bin[0] = sum;

  for(int i = keta - 1;i >= 0 ;i--){
    cout  << bin[i]  ;
  }
  cout << endl;
 
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n;
  while(cin>>n,n+1){
    if(!n){cout<<0<<endl;continue;}
    vector<int>out;
    while(n){
      pb(out,n%4);
      n/=4;
    }
    rep(i,out.size())cout<<out[out.size()-i-1];
    cout<<endl;
  }


}

C++: #include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;

int main(){
	int N;
	while(cin>>N,~N){
		ll ans=0;
		for(int i=0;i<N;i++){
			ans++;
			for(ll j=1; ans/j%10==4; j*=10) ans += j*6;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include <cmath>
#include <queue>
#include<stack>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
	int n,ans;
	while(cin>>n){
		if(n==-1)break;
		if(n<4){
			cout<<n<<endl;
		}else{
			cout<<n/4<<n%4<<endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int a;
	int b;
	int c;
	int counter = 0;
	int maecounter = 0;
	while (1) {
		int k = 0;
		cin >> a;
		if (a == -1) {
			break;
		} else {
			while (a >= 4) {
				c = a;
				while (1) {
					b = c / 4;
					if (b == 0) {
						break;
					}
					k = b;
					counter++;
					c = c / 4;
				}
				if (maecounter > counter+1) {
					for (int i = 0; i < maecounter - (counter+1); i++) {
						cout << 0;
					}
				}
				cout << k;
				a = a - pow(4,counter) * k;
				maecounter = counter;
				counter = 0;
			}
			if (maecounter > counter+1) {
				for (int i = 0; i < maecounter - (counter+1); i++) {
					cout << 0;
				}
			}
			cout << a << endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
int main(){
    long int a,b,c[1024]={0},i,j;
        
        scanf("%ld\n",&a);
        do{
        i=0;
    if(a==0){
        printf("%ld\n",a);
    }
        else if (a!=-1){
        b=a;
                do{
                
        
            a=b%4;
            b/=4;
                        c[i++]=a;
                        //printf("%d",a);
                }while(b>3);
                if(b!=0)
                c[i]=b;
                for(j=i;j>=0;j--){
                        printf("%ld",c[j]);
                }
                printf("\n");
        }
        else{
                break;
        }
        scanf("%ld\n",&a);
        }while(1);
        return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
	int n;
	while(cin >> n){
		if(n==-1)
			break;
		vector<int> ans(0);
		do{
			ans.insert(ans.begin(),n%4);
			n=n/4;
		}
		while(n!=0);
		for(int i=0;i<ans.size();i++)
			cout << ans[i];
		cout << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int n;
  string str;

  while(cin >> n , n != -1){
    str = "";
    if(!n) cout << '0' << endl;
    else{
      while(n){
	str += n % 4 + '0';
	n /= 4;
      }
      reverse(str.begin(),str.end());
      cout << str << endl;
    }
  }

  return 0;
}

C++: #include<iostream>
#include<vector>

using namespace std;

int main(){

  int in;
  while(cin >> in){
    if(in == -1) break;

    vector<int>V;

    while(1){
      V.push_back(in % 4);
      in /= 4;
      if(in == 0) break;
    }

    for(int i = V.size()-1; i >= 0; i--){
      cout << V[i];
    }

    cout << endl;

  }
  return 0;

}

C++: #include<stdio.h>
int a[10000001];
int main(void)
{
	int n;
	int cnt,i;
	
	scanf("%d",&n);
	while(n!=-1){
		cnt=0;
		i=0;
		while(n>=4){
			cnt++;
			a[i]=n%4;
			i++;
			n=n/4;
		}
		printf("%d",n);
		for(i=cnt-1;i>=0;i--){
			printf("%d",a[i]);
		}
		printf("\n");
		scanf("%d",&n);
	}
	return 0;
}

C++: #include<stdio.h>

int main(void){
	int keta,n,i;
	int kai[100000];
	while(0==0){
		scanf("%d",&n); 
		keta=0;
		if(n==-1)break;
		while(n>3){
			kai[keta]=n%4;
			n=n/4;
			keta++;
		}
	  kai[keta]=n;
	  for(i=keta;i>0;i--) printf("%d",kai[i]);
	  printf("%d\n",kai[0]);
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

string ans;
int n;

string changes(int n){
	stringstream ss;
	string res;
	ss << n;
	ss >> res;
	return res;
}

int main(){

	while (cin >> n&&n!=-1){
		if (n == 0){
			cout << 0 << endl;
			continue;
		}
		bool f = 0;
		if (n == -1)break;
		for (int i = 9; i >= 0; i--){
			int a = 0;
			if (n >= pow(4, i)){
				a = n / pow(4, i);
			}
			if (a != 0)f = 1;
			if (f){
				ans += changes(a);
				n -= a*pow(4, i);
			}
			//cout << n << " " << a << endl;
		}
		cout << ans << endl;
		ans.clear();
	}
}