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<stdio.h>

#define N 4

void Nshinsu(int);

int main(){
  while(1){
    int n;
    scanf("%d",&n);
    if(n==-1)break;
    Nshinsu(n);
  }
  return 0;
}

void Nshinsu(int n){

  //  int i,y=0,b=1;
  int i,y=0;
  long long b = 1;

  for(i=0;i<100;i++){    
    y+=(n%N)*b;
    n/=N;
    b*=10;
  }

  printf("%d\n",y);
}

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

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

int main(){
    int n;
    int result;

    while(cin >> n, n != -1){
        solve(n);
        cout << endl;
    }
    return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef map<double, int> MAPDI;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMAPIS;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(), c_end=c.end(); it!=c_end; ++it)

// ------------------- include, typedef, define END. -------------------

void Output(stack<int> &ans){
	while (!ans.empty()){
		cout << ans.top();
		ans.pop();
	}
	cout << endl;
}

int main(){
	int n=4;
	int in;
	while (cin >> in, in>=0){
		stack<int> ans;
		while (in >= n){
			// nで割り切れる限りループ
			ans.push(in%n);
			in /= n;
		}
		ans.push(in);
		Output(ans);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	long long x;
	while(cin>>x&&x!=-1){
	long long z[100000],cnt=0;
	while(true){
		if(x<4)break;
		z[cnt]=x%4;
		x=(x-x%4)/4;
		cnt++;
	}
	z[cnt]=x;
	for(long long i=cnt;i>=0;i--){
		if(z[i]==0)cout<<"0";
		else cout<<z[i];
	}
	cout<<endl;
	}
	return 0;
}

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

            }
            else {
                if (n == 10000) {
                    printf("2130100\n");
                    break;
                }
                n = n - 4;
                masatoy[1] = masatoy[1] + 1;
                for (i = 1; i <= 10; i++) {
                    if (masatoy[i] == 4) {
                        masatoy[i + 1] += 1;
                        masatoy[i] = 0;
                    }
                }
            }
        }scanf("%d", &n);
        for (i = 1; i <= 10; i++) {
            masatoy[i] = 0;
        }
    }

}

C++: #include<iostream>
using namespace std;
int main() {
	int a[100], sum = 1, b = 0, n, c[100], sum2 = 1;
	while (sum <= 1000000) {
		a[b] = sum;
		c[b] = sum2;
		b++;
		sum *= 4;
		sum2 *= 10;
	}
	while (cin >> n&&n != -1) {
		sum = 0;
		for (int i = b - 1; i >= 0; i--) {
			if (n >= a[i]) {
				int d = (n - (n%a[i])) / a[i];
				n -= (a[i] * d);
				sum += (c[i] * d);
			}
		}
		cout << sum << endl;
	}
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

string convert(int n)
{
	if(n==0) return "0";
	string res;
	for(int i=n;i;i/=4)
		res+='0'+i%4;
	reverse(allof(res));
	return res;
}

int main()
{
	for(int n;cin>>n,~n;)
		cout<<convert(n)<<endl;
	
	return 0;
}

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

using namespace std;

int main(){
  int i, n, m, digit;
  vector<int> data;

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

    if(n == 0) data.push_back(0);
    for(digit=4; n!=0; digit*=4){
      m = n % digit;
      data.push_back(m*4/digit);
      n = n - m;
    }

    for(i=data.size()-1; i>=0; --i)
      cout << data[i];
    cout << endl;

    data.clear();
  }

  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
  int n;
  while(cin >> n, n != -1){
    vector<int> four;
    four.push_back(n % 4);
    n /= 4;
    while(n > 0){
      four.push_back(n % 4);
      n /= 4;
    }
    reverse(four.begin(), four.end());
    for(int i = 0; i < four.size(); i++) cout << four[i];
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#define MAX_N 1000000
using namespace std;

int main(){
    int n;
    while(cin >>n){
        if(n == -1) break;
        vector<int> vec;
        int shift = 0;
        for(long int i = 3; i <= MAX_N; i = i << 2){
            int tmp = n & i;
            for(int j = 0; j < shift; j++){
                tmp = tmp >> 2;
            }
            shift++;
            vec.push_back(tmp);
        }
        int stop = vec.size() - 1;
        while(vec[stop] == 0) stop--;
        for(int i = stop; i >= 0; i--){
            cout <<vec[i];
        }
        cout <<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


int n;
string s;

int main(){
	while(cin>>n && n != -1){
		s="";
		int d=1;
		while(d*4<n)d*=4;
		//cout<<n<<" "<<d<<endl;
		for(int i=d; i>0; i/=4){
			s+=(n/i+'0');
			n%=i;
		}
		//s+=(n+'0');
		cout<<s<<endl;
	}
}