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 <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
   
    vector<string> ans;
    while(true){
        int t; cin>>t;
        if(t==-1)break;
        string res;
        while(t!=0){
            res=(char)(t%4+'0')+res;;
            t/=4;
        }
        if(res=="")res="0";
        ans.push_back(res);
    }
    
    REP(i,ans.size())cout<<ans[i]<<endl;
    
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

int main() {
	int n;
	while (cin >> n, n != -1) {
		string ans = "";
		if (n == 0) ans.push_back('0');
		while (n > 0) {
			ans.push_back(n % 4 + '0');
			n = n / 4;
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
	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];
			}
		}
		cout << endl;
	}
}

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

void four(int n);

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

void four(int n){
	if(n / 4 == 0){
		cout << n;
	}
	else {
		four(n/4);
		cout << n % 4;
	}
	return;
}

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 (1) {
			m = x % 4;
			x = (x - m)/4;
			if (bai == 1) {
				z[kai] = m;
			}else {
				z[kai] = z[kai] + m * bai;
			}
			bai = bai * 10;
		}
	}
a:;
	for (i = 1; i <= kai; i++) {
		cout << z[i] << endl;
	}
}

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

using namespace std;

void convert(int n, vector<int> *v) {
  if(n == 0) return;
  convert(n / 4, v);
  v->push_back(n % 4);
}

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

    vector<int> v;
    convert(n, &v);

    for(int i = 0; i < v.size(); i++) {
      cout << v[i];
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int z[2002], x, kai, m, bai;
	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;
			x = x / 4;
			if (bai == 1) {
				z[kai] = m;
			}else {
				z[kai] = z[kai] + m * bai;
			}
			bai = bai * 10;
		}
	}
a:;
	for (int i = 1; i <= kai; i++) {
		cout << z[i] << endl;
	}
}

C++: #include <stdio.h>

int main() {
  int n, i;
  int digits[20];
  while (1) {
    scanf("%d", &n);
    if (n < 0) {
      return 0;
    }
    if (n == 0) {
      puts("0");
      continue;
    }
    for (i = 0; n > 0; ++i) {
      digits[i] = n % 4;
      n /= 4;
    }
    while (i > 0) {
      printf("%d", digits[i - 1]);
      --i;
    }
    puts("");
  }
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(scanf("%d",&n),n!=-1){
		char change[] = {'0','1','2','3'};
		char ans[100000]={0};
		if(n < 4)ans[0] = n+48;
		else{
			for(int i = 0;; i++){
				ans[i] = change[n%4];
				n /= 4;
				if(n < 4){
					ans[i+1] = n+48;
					break;
				}
			}
		}
		int len = strlen(ans);
		reverse(ans,ans+len);
		printf("%s\n",ans);
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
	int n;
	while(cin >> n){
		if(n==-1)break;
		string s;
		if(n==0) s="0";
		else for(int i=(int)(log(n)/log(4));i>=0;--i){
			s+=(char)((int)(n/pow(4,i))+'0');
			n%=(int)pow(4,i);
		}
		cout << s << "\n";
	}
	return 0;
}

C++: #include<stdio.h>

int main(){

int x;

while(1){

scanf("%d",&x);if(x==-1)break;
unsigned long s=0;int k=0;int p=1;
int n[1000]={};int P=0;
while(1){
k=x%4;
//s+=k*p;
n[P]=k;
x=x/4;
if(x==0)break;
p=p*10;P++;
}
for(int i=P;i>=0;i--)
	printf("%d",n[i]);
printf("\n");

//printf("%ld\n",(unsigned long)s);
}
return 0;
}

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

int main()
{
	while (1)
	{
		int s;
		cin >> s;
		if (s == -1)break; 
		if (s == 0)cout << 0 << endl;
		else {
			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 <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

bool solve() {
    int n;
    cin >> n;
    if (n == -1) { return false; }
    string rev = "";
    while (n > 0) {
        int rem = n % 4;
        rev += rem + '0';
        n /= 4;
    }
    if (rev == "") rev = "0";
    reverse(begin(rev), end(rev));
    cout << rev << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}