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;

using ll = long long;

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

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

int main()
{
	int n;
	while( std::cin >> n, ~n )
	{
		std::vector<int> v;

		if( !n )
			v.push_back( 0 );

		while( n > 0 )
		{
			v.push_back( n & 3 );
			n >>= 2;
		}

		for( int i = v.size() - 1; i >= 0; --i )
			std::cout << v[i];
		std::cout << std::endl;
	}

	return 0;
}

C++: #include<cstdio>
int main(){
  int n,f,ans;
  while(scanf("%d",&n),n>=0){
    ans=0;
    f=1;
    while(n>=f*4) f*=4;
    while(f > 0){
      printf("%d",n/f);
      n %= f;
      f /= 4;
    }
    printf("\n");
  }
  return(0);
}

C++: #include <cstdio>
#include <algorithm>
using namespace std;
int quad[100];

void decToQuad(int n) {
    if (n == 0) { printf("0\n"); return; }
    int idx = 0;
    while (n > 0) {
        quad[idx++] = n%4;
        n /= 4;
    }
    for (int i = idx -1; i >= 0; i--) printf("%d", quad[i]);
    printf("\n");
}


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

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

using namespace std;

int main()
{
	for(int n;cin>>n,~n;){
		stack<int> st;
		if(n==0)			st.push(0);
		for(;n>0;n/=4)		st.push(n%4);
		while(!st.empty())	cout<<st.top(),st.pop();
		cout<<endl;
	}
	return 0;
}

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

int main()
{
	int n;
	while( cin >> n && n != -1 ){
		int exp = 1;
		string d;
		while( n > 0 ){
			int m = n % ( 1 << ( 2 * exp ) );
			m /= ( 1 << ( 2 * ( exp - 1 ) ) );
			d.insert( d.begin(), ( m + '0') );
			n -= ( m * ( 1 << ( 2 * ( exp - 1 ) ) ) );
			++exp;
		}
		if( d.empty() ){
			d = '0';
		}
		cout << d << endl;
	}

	return 0;
}

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

int main() {
	int n;
	while (cin >> n&&n != -1) {
		stack<int>s;
		while (n >= 4) {
			s.push(n % 4);
			n /= 4;
		}
		s.push(n);
		int a = s.size();
		for (int i = 0;i < a;i++) {
			cout << s.top();
			s.pop();
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

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

int main(void){
  int n;
  while(cin>>n){
    if(n==-1) break;
    if(n==0){
      printf("0\n");
      continue;
    }
    stack<int> stk;
    while(n!=0){
      stk.push(n%4);
      n/=4;
    }
    while(!stk.empty()){
      printf("%d",stk.top());
      stk.pop();
    }
    printf("\n");
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( void )
{
	int n;
	while ( cin >> n && n != -1 )
	{
		vector <int> numbers;
		int w = n;
		while ( w >= 4 )
		{
			numbers.push_back( w % 4 );
			w /= 4;
		}
		numbers.push_back( w % 4 );

		reverse( numbers.begin(), numbers.end() );
		for ( vector <int>::iterator it = numbers.begin(); it != numbers.end(); it++ )
		{
			cout << *it;
		}
		cout << endl;
	}
	return 0;
}

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) {
	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>

using namespace std;

int main()
{
	int n;

	while (true)
	{
		cin >> n;

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

		if (n == 0)
		{
			cout << "0" << endl;
		}
		else
		{
			int t = (1 << 20);

			for (int i = 0; i < 10; i++)
			{
				t /= 4;

				if (n / t)
				{
					cout << (n / t) % 4;
				}
			}

			cout << endl;
		}
	}

	return 0;
}

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=10;i>=0;i--) {
			if(n==0&&flg==0) {
				cout<<"0";
				break;
			}
			if(n/fo[i]>0) {
				cout<<n/fo[i];
				n=n%fo[i];
				flg=1;
			}
			else if(flg==1) cout<<"0";
		}
		cout<<endl;
	}
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
char s[4^10];
int main(void){
	int n,x,w,u,cnt,i;
	while(1){
		cin>>n;
		if(n==-1) break;
		cnt=0;
		while(1){
			s[cnt]=n%4+'0';
			n=n/4;
			cnt++;
			if(n==0){
				cnt--;
				break;
			}
			if(n<4){
				s[cnt]=n+'0';
				break;
			}
		}
		for(i=cnt;i>=0;i--) cout<<s[i];
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	while(cin >> n){
		if(n==-1)break;
		string s;
		string temp;
		for(int i=0;n>>i;i+=2){
			temp+=((char)(n>>i)%4)+'0';
		}
		if(temp.empty())temp="0";
		for(int i=temp.size()-1;i>=0;--i)s+=temp[i];
		cout << s << "\n";
	}
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	while (1) {
		int n; cin >> n;
		if (n == -1)break;
		else if (n == 0) {
			cout << 0 << endl;
		}
		else {
			string st;
			while (n) {
				st.push_back(n%4 + '0');
				n /= 4;
			}
			reverse(st.begin(), st.end());
			cout << st << endl;
		}
	}
	return 0;
}

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

int main() {
    while (1) {
        long long int n = 0;
        long long int result = 0;
        
        cin >> n;
        if (n == -1) {
            break;
        }
        
        long long int temp = 0;
        
        for (long long int i = 0; n != 0; i++) {
            temp = n;
            
            n &= 3;
        
            for (long long int j = 0; j < i; j++) {
                n *= 10;
            }
            
            result += n;
        
            n = temp;
            
            n = n >> 2;
        }
        
        cout << result << endl;
    }
    return 0;
}

C++: #include<iostream>
int main()
{
	long long n,s,k;
	while(std::cin>>n,n>=0)
	{
		for(s=0,k=1;n;) s+=n%4*k,n/=4,k*=10;
		std::cout<<s<<'\n';
	}
	return 0;
}

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

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

}