#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                             it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;

// up right down left
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};

const double EPS = 1e-9;
const int days[]     = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    int k;
    cin >> k;
    for(int kk = 0;kk<k;kk++){
        string a,b;
        cin >> a;
        cin >> b;

        string ret;

        int n = max(a.size()+1,b.size()+1);
        {
            stringstream ss;
            ss << setfill('0') << setw(n) << a;
            ss >> a;
        }
        {
            stringstream ss;
            ss << setfill('0') << setw(n) << b;
            ss >> b;
        }
        string c;
        c.resize(n);
        int up = 0;
        for(int i=a.size()-1;i>=0;i--){
            int now = a[i]-'0' + b[i]-'0' + up;
            if(now >= 10){
                up = now / 10;
                now -= 10;
            }else{
                up = 0;
            }
            c[i] = now+'0';
        }
        string s;
        for(int i=0;i<n;i++){
            if(c[i] != '0'){
                for(int j=i;j<n;j++){
                    s += c[j];
                }
                goto end;

            }
        }
    end:
        cout << s << endl;
    }
    return 0;
}