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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

void f(int n){
	if(n>3)f(n/4);
	cout<<n%4;
}

int main() {
	int n;
	while(n=in(),n>=0){
		f(n);
		cout<<endl;
	}
	return 0;
}

C++: #include<iostream>

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 = "";
		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<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--;
            if(stop == 0) break;
        }
        if(stop == 0){
            cout <<"0" <<endl;
        } else{
            for(int i = stop; i >= 0; i--){
                cout <<vec[i];
            }
            cout <<endl;
        }
    }
    return 0;
}

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

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

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

int main() {
  int n;
  while(cin >> n && (n>=0)) {
    string s;
    while(n>0) {
      s=(char)('0'+n%4)+s;
      n/=4;
    }
    if(s=="")s="0";
    cout << s << endl;
  }
  return 0;
}

C++: #include <cstdio>

using namespace std;

int main()
{
 int n;

 while (~scanf("%d", &n)){
  if (n == 0) printf("0\n");
  else {
   bool flag = false;
   for (int i = 30; i >= 0; i -= 2){
    if ((n >> i) & 3 != 0 || flag){
     printf("%d", (n >> i) & 3);
     flag = true;
    } 
   }
   printf("\n");
  }
 }
 return (0);
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int n;

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

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

void foo(int n){
	if(0<n){
		foo(n/4);
		cout<<(n%4);
	}
}

main(){
	while(true){
		int n;
		cin>>n;
		
		if(n<0){
			break;
		}
		
		if(0<n){
			foo(n);
			cout<<endl;
		}else{
			puts("0");
		}
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	while(1){
		int n,a=0,f=0;
		cin>>n;
		if(n==-1) break;
		if(n==0){
			cout<<0<<endl; continue;
		}
		string s;
		rep(i,0,9){
			a=n/(int)pow(4,8-i);
			n%=(int)pow(4,8-i);
			if(a){
				cout<<a; f=1;
			}
			else if(a==0&&f==1) cout<<0;
			if(i==8) cout<<endl;
		}
	}
}

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


void ten_to_four(int x){
  
  if(x == 0) cout << "0\n";
  vector<int> ans;
  for(int i=0; x!=0 ; i++){
    ans.push_back(x % 4);
    x = (x - (x%4))/4;
  }
  for(int i=ans.size()-1; i>=0 ;i--){
    cout << ans[i] ;
    if(i == 0) cout << "\n";
  }
  
}


int main(){

  while(1){
    int x; cin >> x;
    if(x == -1) break;
    ten_to_four(x);
  }

}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
    int n;
    while(cin>>n&&n!=-1){
        long i=0,ans=0;
        while(n){
            ans+=(n%4)*pow(10,i);
            n/=4;
            i++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#include<string>
#include<cctype> 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
  int n;
  int a[]={262144,65536,16384,4096,1024,256,64,16,4,1};
  int i,j,s=10;
  int ans=0;
  cin >> n;
 
  if(n==0){
    cout << 0;
  }
  rep(i,10){
    if(n>=a[i]){  
      if(i<s){
	s=i;
      }
    }
  }
  for(i=s;i<10;i++){
    cout << n/a[i]; 
    n=n%a[i];
  }
                     
  cout <<'\n';
                
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
string calc(int n){
  string s;
  int x=1;
  while(n){
    char c='0'+n%4;
    s=c+s;
    n/=4;
  }
  return s;
}
int main(){
  int n;
  while(cin>>n,n!=-1){
    if(n==0) cout << 0 << endl;
    else cout << calc(n) << endl;
  }
  return 0;
}

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

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

    if (n == 0) {
      cout << n << endl;
      continue;
    }

    vector<int> ans;
    while (n) {
      ans.push_back(n%4);
      n /= 4;
    }

    for (int i = ans.size()-1; i >= 0; --i)
      cout << ans[i];
    cout << endl;
  }
  return 0;
}

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

long long Quaternary(long long d) {
  vector<long long> v;
  while(d != 0) {
    v.push_back(d % 4); // d % 4 = 3
    d /= 4; // d / 4 = 1
  }
  
  long long j = 1, res = 0;
  for(int i = 0 ; i < v.size() ; i++) {
    res += (j * v[i]);
    j *= 10;
  }
  return res;
}

int main() {
  int decimal;
  while(cin >> decimal, decimal != -1) {
    cout << Quaternary(decimal) << endl; // 10 -> 4
  }
}