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 <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };

int n;

int main() {
	while ( ~scanf( "%d", &n ) && ~n ) {
		if ( n == 0 ) {
			printf( "0\n" );
			continue;
		}
		LL ans = 0;
		int now_d = 0;
		while ( n != 0 ) {
			LL b = n % 4;
			for ( int i = 0; i < now_d; i++ ) {
				b *= 10;
			}
			ans += b;
			now_d++;
			n /= 4;
		}
		printf( "%lld\n", ans );

	}
	return 0;
}

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

int main(){
	int n;
	while(cin >> n && n != -1 ){
		if( n == 0 ) cout << 0 << endl;
		else{
			string s;
			while(n){
				s += n % 4 + '0';
				n /= 4;
			}
			for(int i = s.size()-1 ; i >= 0 ; i--)
				cout << s[i];
			cout << endl; 
		}
	}
}

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("%d\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>
using namespace std;
int main() {
	int z[2002], x, kaisuu, m, kai;
	kaisuu = 0;
	while (1) {
		cin >> x;
		if (x == -1) {
			goto a;
		}
		kaisuu = kaisuu + 1;
		kai = 1;
		while (1) {
			m = x % 4;
			x = x - m;
			x = x / 4;
			if (kai == 1) {
				z[kaisuu] = m;
			}
			else {
				z[kaisuu] = z[kaisuu] + m * kai;
			}
			kai = kai * 10;
			if (x == 0) {
				goto aa;
			}
		}
	aa:;
	}
a:;
	for (int i = 1; i <= kaisuu; i++) {
		cout << z[i] << endl;
	}
}

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

using namespace std;

vector<int> temp;

void Device(int num);
void Output();

int main() {

	int num;

	while (cin >> num && num != -1) {

		if (num == 0)
			cout << "0\n";

		else {
			Device(num);
			Output();

		}
	}
	
	return 0;

}

void Device(int num) {

	temp.clear();
	while (num) {

		temp.push_back(num % 4);
		num /= 4;

	}

}

void Output() {
	for (int i = temp.size() - 1; i >= 0; i--)
		cout << temp[i];
	cout << "\n";
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

map<string,string> m;

string b2f(string bin) {
  if (bin.size() % 2) bin = string("0") + bin;
  
  string ret;
  for (int i = 0; i < bin.size(); i+=2) {
    string temp = bin.substr(i, 2);
    ret += m[temp];
  }
  return ret;
}

string d2b(int a) {
  if (a == 0) return string("0");
  string s;
  while (a) {
    string b(" ");
    char c = '0' + (a % 2);
    b[0] = c;
    s += b;
    a /= 2;
  }
  reverse(s.begin(), s.end());
  return s;
}

int main() {
  const string b[4] = {"00", "01", "10", "11"};
  const string d[4] = {"0", "1", "2", "3"};
  rep (i,4) m.insert(make_pair(b[i], d[i]));

  int n;
  while (cin >> n) {
    if (n == -1) break;
    cout << b2f(d2b(n)) << endl;
  }
  return 0;
}

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

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

C++: #include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)

void convert(int x) {
	if (x == 0) {
		cout << 0 << endl;
		return;
	}
	
	int mul = 16777216;
	bool flag = false;
	
	for_rev(i,12,0) {
		if (flag || x / mul > 0) {
			cout << x / mul;
			x -= (x / mul) * mul;
			flag = true;
		}
				
		mul /= 4;
	}
	
	cout << endl;
}

int main() {
	int n;
	while (cin >> n, n != -1) convert(n);
}

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

int main(){
  int n;

  while( cin >> n ){
    if(n == -1)break;
    vector<int>ve;
    while(1){
      ve.push_back(n%4);
      n/=4;
      if(n == 0)break;
    }
    for(int i = ve.size()-1 ; i >= 0 ; i-- )cout << ve[i];
    cout << endl;
  } 
}

C++: // Tazoe

#include <iostream>
using namespace std;

void trans(int n)
{
	if(n/4!=0){
		trans(n/4);
	}

	cout << n%4;
}

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

		if(n==-1)
			break;

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

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int a, b[20], ok;
int main() {
	while (true) {
		ok = 0;
		cin >> a;
		if (a == -1) { break; }
		for (int i = 0; i < 15; i++) {
			b[i] = (a / (int)pow(4, i)) % 4;
		}
		for (int i = 14; i >= 0; i--) {
			if (b[i] >= 1) { ok = 1; }
			if (ok == 1 || i == 0) {
				cout << b[i] << endl;
			}
		}
	}
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main(){
	while(true){
		int a;
		vector<int> b;
		cin >> a;
		if(a==-1) break;
		if(a==0){
			cout << 0 << endl;
			continue;
		}
		while(a>0){
			b.push_back(a%4);
			a/=4;
		}
		for(int i=b.size()-1;i>=0;i--){
			cout << b[i];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {

    int n;

    while(1){

        scanf(" %d",&n);

        if(n==-1){
            break;
        }

        string s;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                s = '3' + s;
            }
            else if(a == 2){
                s = '2' + s;
            }
            else if(a == 1){
                s = '1' + s;
            }
            else{
                s = '0' + s;
            }

             n /= 4;

        }

        cout << s << endl;

    }

    return 0;
}