//include
//------------------------------------------
#include <bits/stdc++.h>

using namespace std;

////typedef
////------------------------------------------
//typedef vector<int> vi;
//typedef vector<vi> vii;
//typedef vector<string> vs;
//typedef vector<bool> vb;
//typedef vector<vb> vbb;
//typedef pair<int, int> pii;
//typedef long long ll;
//typedef unsigned long long ull;
//
////container util
////------------------------------------------
//#define all(a)  (a).begin(),(a).end()
//#define rall(a) (a).rbegin(), (a).rend()
//#define pb push_back
//#define mp make_pair
//#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
//
////repetition
////------------------------------------------
//#define loop(i,a,b) for(int i=(a);i<(b);++i)
//#define rep(i,n)  loop(i,0,n)
//
////constant
////--------------------------------------------
//const double eps = 1e-10;
//const double pi  = acos(-1.0);
//const double inf = (int)1e8;
//
//// output vector
//// ------------------------------------------
//namespace std {
//    template<typename T> ostream & operator<<(ostream& os, vector<T> const& v){
//        for(auto it=v.begin(); it!=v.end(); ++it){
//            os << *it << (it+1==v.end() ? "" : ",");
//        }
//        return os;
//    }
//}
//
////clear memory
//#define clr(a) memset((a), 0 ,sizeof(a))

string IntToString(int number) {
    stringstream ss;
    ss << number;
    return ss.str();
}

int main(){
    int n;
    cin >> n;
    for(int p=0; p < n; p++){
        string ans;
        string s, t;
        cin >> s >> t;
        if(s.size() > t.size()) swap(s, t);


        int q = t.size()-s.size();
        for(int i=0; i < q; i++) s = "0" + s;

        int up = 0;
        for(int i=s.size()-1; 0 <= i; i--){
            int d = atoi(s.substr(i, 1).c_str());
            int f = atoi(t.substr(i, 1).c_str());
            ans = IntToString((d+f+up)%10) + ans;

            if(0 <= d+f+up-10) up = 1;
            else up = 0;
        }
        if(up == 1) ans = IntToString(1) + ans;
        cout << ans << endl;
     }
}