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

int main(){
  int n;
  vector<int> ans;

  while(1){
    cin >> n;
    if(n<0)break;

    ans.clear();
    while(n/4){
      ans.push_back(n%4);
      n/=4;
    }
    ans.push_back(n);
    
    for(int i=ans.size()-1;i>=0;i--)cout << ans[i];
    cout << endl;
  }
}

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

const int MASK = 0x03, P = 10;

int main(){
	long long 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>
using namespace std;

vector<int> bit;

void convert(int x){
  if(x == 0) return;
  convert(x/4);
  bit.push_back(x%4);
}

int main(){
  int n;

  while(1){
    bit.clear();
    cin >> n;
    if(n == -1) break;
    convert(n);

    if(bit.size()>0){
      for(int i = 0; i < bit.size(); i++){
	cout << bit[i];
      }
      cout << endl;
    }
    else {
      cout << "0" << endl;
    }
  }
  return 0;
}

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

int main(){

	int n;
	vector<int> vc;
	
	while(cin >> n){
		if(n == -1) break;
		vc.clear();
		
		while(1){
			if(n == 0) break;
			vc.insert(vc.begin(), n % 4);
			n = (n - n % 4) / 4;
		}
		
		for(int i=0; i<vc.size(); i++){
			cout << vc[i];
		}
		if(n == 0) cout << '0';
		cout << endl;
	}

	return 0;

}

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

    long int n;

    while(1){

        scanf(" %ld",&n);

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

        string s;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                cout << 3;
            }
            else if(a == 2){
                cout << 2;
            }
            else if(a == 1){
                cout << 1;
            }
            else{
                cout << 0;
            }

             n /= 4;

        }

        cout << endl;

    }

    return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main()
{
  int n;
  vector<int> v;
  vector<int>::reverse_iterator it;
  for(;;){
    cin >> n;
    if(n < 0) break;
    if(n == 0){
      cout << "0" << endl;
      continue;
    }
    v.clear();
    while(n != 0){
      v.push_back(n%4);
      n /= 4;
    }
    it = v.rbegin();
    while(it != v.rend()){
      cout << (*it);
      it++;
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;

string change(int n){
  int sum = 0;
  string str = ""; 

  while(n > 0){
    str += (n % 4) + '0'; 
    n /= 4;
  }
  reverse(str.begin(),str.end());
  return str;
}

int main(){
  int n;

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

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(1){
		int b[10000],i;
		cin>>n;
		if(n==0){
			cout<<0<<endl;continue;
		}
		if(n==-1)break;
		for(i=0;n>0;i++){
			b[i]=n%4;
			n/=4;
		}
		while(i>0)cout<<b[--i];
		cout<<endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

string dec2four (int n)
{
	string res = "";

	while ( n > 0 ){
		res += n % 4 + '0';
		n /= 4;
	} // end while

	reverse (res.begin(), res.end() );

	return res;
}
int main()
{
//	cut here before submit 
//	freopen ("testcase.dec24", "r", stdin );
	string str = "";
	string res = "";
	int n;

	while (getline (cin, str ) ){
		stringstream ssn(str);
		ssn >> n;

		if (n == -1 ){
			break;
		} // end if
		if (n == 0){
			res = "0";
		}else{
			res = dec2four (n);
		} // end if

		cout << res << endl;
	} // end loop
		
	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
    int n;
    while (cin>>n, ~n) {
        if (!n) { cout << 0 << endl; continue; }
        int i = 1<<20;
        while (n < i) i >>= 2;
        for (; i>=1; i>>=2) { cout << n / i; n %= i; }
        cout << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int pow(int a,int b){
	int result=1;
	for(int i=0; i<b; ++i) result*=a;
	return result;
}

int main(){
	int N;
	while(std::cin >> N&&N!=-1){
		int i=0;
		while(pow(4,i)<=N+1) ++i;
		--i;
		for( ; i>=0; --i){
			int tmp=N/pow(4,i);
			std::cout << tmp;
			N%=pow(4,i);
		}
		std::cout << std::endl;
	}
	return 0; 
}

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

void conv(int n)
{
	if(n/4!=0){
		conv(n/4);
	}

	cout << n%4;
}

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==-1)
			break;

		conv(n);
		cout << '\n';
	}

	return 0;
}

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

using namespace std;

int n = 0;

bool input(){
  	cin >> n;
    if (n == -1) {
  	    return (false);
 	}
 	return (true);
}

string ans(){
    string res = "";
  	while (n != 0){
        res = char('0' + n % 4) + res;
        n /= 4;
    }
    if (res.size() == 0){
		res = "0";
    }
    
	return (res);
}

int main(){
    while(input()){
        string a = ans();
        cout << a << endl;
    }
	
	return (0);
}

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

int jou(int x,int y){
  int ans = 1,i;

  for(i = 0;i < y;i++){
    if(y != 0) ans *= x;
  }
  if(y == 0) ans = 1;
  return ans;
}


int main(){
  int keta = 0,n;
  int bin[999];

  while(1){
    cin >> n;
    if(n == -1) break;
    int sum = n;
    //keta
    while(1){
      if(n < 4 )break;
      keta++;   
      n /= 4;
    }

    keta ++;
    // cout << "keta = " << keta << endl;

    for(int i = keta - 1;i > 0;i--){
      bin[i] = sum / jou(4,i);
      // cout << "bin[i] = " << bin[i] << "jou(4,1) = " << jou(4,i) << endl;
      sum = sum - jou(4,i) * bin[i];
    }

    bin[0] = sum;

    for(int i = keta - 1;i >= 0 ;i--){
      cout  << bin[i]  ;
    }
    cout << endl;
    keta = 0;
  }
 
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;

int main(){
	int N;
	while(cin>>N,~N){
		ll ans=0;
		for(int i=0;i<N;i++){
			ans++;
			for(ll j=1; ans/j%10==4; j*=10) ans += j*6;
		}
		printf("%lld\n",ans);
	}
	return 0;
}