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>
using namespace std;

const int MASK = 0x03, P = 10;

int main(){
	int n, res, pow;
	while(cin >> n, n != -1){
		res = 0;
		pow = 1;
		while(n != 0){
			int digit = n & MASK;
			res += digit * pow;
			n >>= 2;
			pow *= P;
		}
		cout << res << endl;
	}
	return 0;
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	while(cin >> n)
	{
		if(n == -1) break;
		
		long long ans = 0;
		
		for(int i=0;n>0;i++)
		{
			ans += (n%4)*pow(10,i);
			n /= 4;
		}

		cout << ans << endl;
	}
	return 0;
}

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

int main(){
	int n,t;
	while(1){
		string a;
		cin >> n;
		if(n==-1){
			return 0;
		}
		if(n==0){
			a += '0';
		}
		for(t=0;n!=0;t++){
			a += '0' + n%4;
			n=n/4;
		}
		reverse(a.begin(), a.end());
		cout << a << endl;

	}
}

C++: #include <iostream>
#include <string>
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<stdio.h>
int main(void)
{
	long long int a,b,c,i;
	scanf("%lld",&a);
	b=0; c=0;
	for(i=1;i<a;i++){
		c++;
		b++;
		if(c==4){
			c=0;
			b=b/10*10+10;
		}
	}
	printf("%lld",b);
	return 0;
}

C++: #include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
using Graph=vector<vector<int>>;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){

  int count=0;
  int l[2020];
  for(int i=0;i<2000;i++){
    int n;
    cin>>n;
    if(n==-1){
      break;
    }
    else{
      l[i]=n;
      count++;
    }
  }
  rep(i,count){
    string t;
    int r=l[i];
    if(r<4) {
      cout<<r<<endl;
      continue;
    }
    while(r>=4){
      t+=to_string(r%4);
      r=r/4;
      if(r<4) t+=to_string(r);
    }
    reverse(all(t));
    cout<<t<<endl;
  }
  return 0;
}

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

using namespace std;

int main(){

	int n,table[11],count;
	bool First;

	for(int i=0; i <= 10; i++)table[i] = pow(4,i);

	while(true){
		scanf("%d",&n);
		if(n == -1)break;

		First = true;

		for(int i = 10; i >= 0; i--){
			count = 0;
			while(n >= table[i]){
				n -= table[i];
				count++;
			}
			if(count == 0 && First){
				//Do nothing
			}else{
				printf("%d",count);
				First = false;
			}
		}
		if(First == true)printf("0");
		printf("\n");
	}
    return 0;
}

C++: #include <stdlib.h>
#include <stdio.h>

int main(void)
{
	int n;
	char buf[256];
	
	while (1){
		scanf("%d", &n);
		
		if (n == -1) break;
		
		int i = 0;
		do {
			buf[i++] = (n % 4) + '0';
			n /= 4;
		} while (n != 0);
		buf[i] = '\0';
		char out[256];
		for (int j = 0; j < i; j++){
			out[j] = buf[i - j - 1];
		}
		out[i] = '\0';
		
		printf("%s\n", out);
	}
	
	return (0);
}

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

int main() {
  int n;
  while(cin >> n && n!=-1) {
    int k=262144;
    string s="";
    while(1) {
      char a='0';
      if(n>=k) {
	a=(char)(n/k+48);
      }
      s+=a;
      if(k==1) break;
      n%=k;
      k/=4;
    }
    stringstream ss;
    ss << s;
    long long m;
    ss >> m;
    stringstream ss2;
    ss2 << m;
    ss2 >> s;
    cout << s << 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 {
                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 <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n;
    while (scanf("%d", &n) && n != -1) {
        string res = "";
        if (n == 0) {
            printf("0\n");
            continue;
        }
        while (n > 0) {
            res += (n % 4 + '0');
            n /= 4;
        }
        reverse(res.begin(), res.end());
        cout << res << endl;
    }
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int n;
	while (cin >> n, n != -1) {
		vector<int>v;
		do {
			v.push_back(n % 4);
			n /= 4;
		} while (n != 0);
		for (int i = v.size() - 1; i >= 0;i--) {
			cout << v[i];
		}
		cout << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main() {
	int n;
	while (cin >> n, ~n) {
		string ans;
		while (n) {
			ans += to_string(n % 4);
			n >>= 2;
		}
		reverse(ans.begin(), ans.end());
		if (ans == "")ans = "0";
		cout << ans << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,cnt=1,flg;
	int n;
	int fo[10]={1,4,16,64,256,1024,4096,16384,65536,262144};
	while(1) {
		cin>>n;
		flg=0;
		if(n==-1) break;
		for(i=9;i>=0;i--) {
			if(n==0&&flg==0) {
				cout<<"0";
				break;
			}
			if(n/fo[i]>0&&n!=0) {
				cout<<n/fo[i];
				n=n%fo[i];
				flg=1;
			}
			else if(flg==1) cout<<"0";
		}
		cout<<endl;
	}
	return 0;
}

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

C++: #include <iostream>

using namespace std;

void dfs(int n) 
{
    if (n != 0) {
        dfs(n / 4);
        cout << n % 4;
    }        
}

int main()
{
    int n;

    while (cin >> n, n != -1) {
        if (n == 0)
            cout << 0;
        else
            dfs(n);
        cout << endl;
    }

    return 0;
}