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>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n;
	cin >> n;
	if(n == -1) break;
	vector<int> ans;
	if(n == 0){
	    cout << 0 << endl;
	    continue;
	}
	while(n > 0){
	    ans.PB(n%4);
	    n /= 4;
	}
	REP(i,ans.size()) cout << ans[ans.size()-1-i];
	cout << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n;
    while(cin>>n&&n!=-1){
        int ans=0;
        for(int i=0;;i++){
            ans+=(n%4*pow(10,i));
            if(n/4==0) break;
            n=n/4;
        }
        cout<<ans<<endl;
    }
    return 0;
}



AOJ 0175 why wrong answer?

C++: #include<stdio.h>

int main(){

int x;

while(1){

scanf("%d",&x);if(x==-1)break;
long s=0;int k=0;int p=1;
while(1){
k=x%4;
s+=k*p;
x=x/4;
if(x==0)break;
p=p*10;
}
printf("%ld\n",s);
}
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	while(cin>>n&&n!=-1){
		int ans=0;
		for(int i=1;n>0;i*=10,n/=4)ans+=n%4*i;
		cout<<ans<<endl;
	}
}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	int n;
	while(cin>>n){
		if(n==-1)break;
		string str="";
		while(true){
			stringstream ss;
			ss <<n%4;
			n /=4;
			str =ss.str()+str;
			if(n==0)break;
		}
		cout <<str<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,n4,wm;
  while(1){
    wm=262144;
    n4=0;
    cin >> n;
    if(n<0)break;
    for(int i=0;wm!=1;i++){
      n4*=10;
      if(n/wm!=0){
	n4+=n/wm;
	n%=wm;
      }
      wm/=4;
    }
    n4*=10;
    if(n!=0){
      n4+=n;
    }
    cout << n4 << endl;
  }
  return 0;
}

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

int main()
{
  int n, i;
  char c[20];
  while(true)
  {
    for(i = 0; i < 20; i++)
      c[i] = 0;
    c[0] = '0';
    cin >> n;
    if(n < 0)
      break;
    for(i = 0; n > 0; i++)
    {
      c[i] = n % 4 + '0';
      n = n / 4;
    }
    reverse(c, c + i);
    cout << c << endl;
  }
}

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

long convert(long n);

int main(void){
  long n;
  while(1){
    cin>>n;
    if(n==-1)break;
    cout<<convert(n)<<endl;
  }
  return 0;
}

long convert(long n){
  long base=1;
  long retval=0;
  while(n>0){
    retval+=base*(n%4);
    base*=10;
    n=n/4;
  }
  return retval;
}

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

long long quaternary(int n)
{
	std::stack<int> st;
	while (n>0) {
		st.push(n%4);
		n /= 4;
	}
	long long res = 0;
	while (!st.empty()) {
		res *= 10;
		res += st.top(); st.pop();
	}
	return res;
}

int main()
{
	int n;
	while (true) {
		std::cin >> n;
		if (n==-1) break;
		std::cout << quaternary(n) << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(void){
    int n;
    while(1){
        vector<int> c;
        cin>>n;
        if(n==-1)break;
        if(n==0)
        cout<<0;
        while(n>0){
        c.push_back(n%4);
        n/=4;
        }
        for(int i=c.size()-1;i>=0;i--)
        cout<<c[i];
        cout<<endl;

    }
    return 0;
}

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

int main() {
	while(1){
		long n; cin >> n ; if(n==-1) break;
		string str="";
		if(!n) str="0";
		while(n){
			char ch='0';
			ch+=n%4;
			str+=ch;
			n/=4;
		}
		for(int i=str.size()-1;i>=0;i--) cout << str[i] ;
		cout << '\n' ;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
 
int main(){
    long long n;
    long long b[11];
    b[0] = 1;
    for(int i = 1; i <= 10; i++){
    	b[i] = b[i - 1] * 10;
    }
    while(true){
    	cin >> n;
    	if(n == -1)break;
    	long long ans = 0;
    	int i = 0;
    	while(n != 0){
    		ans += (n % 4) * b[i];
    		n /= 4;
    		i++;
    	}
    	cout << ans << endl;
    }
    return 0;
}

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

int main(){
	int n;
	int ans[30];
	int hoge;
	while(cin >> n, 0 <= n){
		for(int i=0; i < 30; i++){
			hoge = i;
			ans[i] = n%4;
			if(n < 4) break;
			n /= 4;
		}
		for(int i=hoge; 0 <= i; i--){
			cout << ans[i];
		}
		cout << endl;
	}
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		ll N=in();
		if(N<0) break;

		ll V=N;
		string S;
		while(V/4){
			char M = V%4;
			S.push_back(M+'0');
			V/=4;
		}
		S.push_back((char)V+'0');
		reverse(ALL(S));
		out(S);
	}
	
	return 0;
}

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

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

using namespace std;

void solve()
{
	int n;
	while(cin >> n)
	{
		vector<int> a;
		if(n == -1)
		{
			break;
		}
		else if(n == 0)
		{
			cout << 0 << endl;
			goto NEXT;
		}
		while(n)
		{
			a.push_back(n % 4);
			n /= 4;
		}
		reverse(a.begin(), a.end());
		for(int i = 0; i < a.size(); ++i)
		{
			cout << a[i];
		}
		cout << endl;
NEXT:
		;
	}
}

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