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 <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define MP make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;


int main(){
    int n;
    while(cin>>n){
        if(n==-1)break;
        string s;
        if(n==0){
            cout<<0<<endl;
            continue;   
        }
        while(n>0){
            s.insert(s.begin(),'0'+n%4);
            n/=4;
        }
        cout<<s<<endl;
    }

    
    return 0;
}

C++: #include<iostream>
#include<bitset>
#include<string>
using namespace std;
int main() {
    int n, a,j=0;
    bool bo = false;
    int ans[102] = { 0 },ans1=0;
    bitset <101> bset;
    while (1) {
		cin >> n;
		if(n==-1){
			break;
		}
        bset = n;
        for (int i = bset.size() - 1; i >= 0; i--) {
            if (i % 2 == 0) {
                if (1 & bset[i] == 1) {
                    ans[j] += 1;
                }
                if (i != 0) {
                    j++;
                }
            }
            else {
                if (1 & bset[i] == 1) {
                    ans[j] += 2;
                }
            }
        }
        for (int i = 0; i <= j; i++) {
            if (ans[i] != 0) {
                bo = true;
            }
            if (bo) {
                cout << ans[i];
            }
        }
		if(bo==false){
			cout<<0;
		}
		cout << endl;
        bo = false;
        for (int i = 0; i < 102; i++) {
            ans[i] = 0;
        }
        j = 0;
        bset = 0;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,ans[100],i;
  while(cin>>n){
    if(n==-1) break;
    i=0;
    while(n>=4){
      ans[i] = n % 4;
      n /= 4;
      i++;
    }
    ans[i] = n;
    for(int j=i;j>=0;j--) cout << ans[j];
    cout << endl;
  }
  return 0;
}

C++: // 2012/09/20 Tazoe

#include <iostream>
using namespace std;

void conv(int n)
{
	if(n<=0)
		return;

	conv(n/4);

	cout << n%4;
}

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==-1)
			break;

		conv(n);
		cout << '\n';
	}

	return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
using namespace std;
int main(){
	
	
	long long n;
	
	
	while(cin>>n,n!=-1){
		bool f=false;
		string s="";
		for(int k=9;k>=0;k--){
			int i=int(pow(4,k));
			int count=0;
			for(int j=0;j<3;j++){
				if(n-i>=0){
					n=n-i;
					count++;
				}
				else
					break;
			}
			if(count!=0||f)
			s=s+to_string(count);
			if(s!="")
				f=true;
			
		}
		if(!f)
			s="0";
		cout<<s<<endl;
	}
			

}

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

int n;

int main(){
	while( cin >> n ){
		if( n == -1 )break;
		
		int ans[30],cor = 0;
		
		while( n > 0 ){
			ans[cor] = n%4;
			n/=4;
			cor++;
		}
		for(int i = cor-1;i>=0;i--)
			cout << ans[i];
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <list>
using namespace std;
int main()
{
	int n, x, p, l, i, r[11];
	while (cin >> n, (x = n) != -1)
	{
		p = l = 0;
		while (x != 0)
		{
			r[p++] = x % 4;
			x /= 4;
			l++;
		}
		for (i = l-1; i >= 0; i--)
			cout << r[i];
		if (!n) cout << 0;
		cout << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,wm;
  long long n4;
  while(1){
    wm=262144;
    n4=0;
    cin >> n;
    if(n<0)break;
    for(int i=0;wm!=1;i++){
      n4*=10;
      if(n/wm!=0){
	n4+=n/wm;
	n%=wm;
      }
      wm/=4;
    }
    n4*=10;
    if(n!=0){
      n4+=n;
    }
    cout << n4 << endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n), ~n)
	{
		stack<char> d;
		do
		{
			d.push('0' + n % 4);
			n /= 4;
		} while (n);
		for (; !d.empty(); d.pop())
			putchar(d.top());
		putchar('\n');
	}

	return 0;
}

C++: #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);
}

C++: #include<stdio.h>

int main(){

int x;
int p=1;
while(1){

scanf("%d",&x);if(x==-1)break;
int s=0;int k=0;
while(1){
k=x%4;
s+=k*p;
x=x/4;
if(x==0)break;
p=p*10;
}
printf("%d\n",s);
}
return 0;
}

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

C++: #include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 10000000;
using namespace std;
/** Problem0175 : A King in Hawaii **/
int main()
{
	int n;
	while (cin>>n, n!=-1) {
		string ans;
		while (1) {
			ans+=(n%4)+'0';
			n/=4;
			if (n == 0) break;
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
	return 0;
}

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

string four(int n){
	string ret;
	while(n){
		ret += (char)(n%4+'0');
		n/=4;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}

int main(){
	int n;
	while(cin >> n && n != -1){
		cout << four(n) << endl;
	}
}