#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main( void )
{
	int n;
	cin >> n;
	for ( int i = 0; i < n; i++ )
	{
		string a;
		string b;
		cin >> a >> b;

		reverse( a.begin(), a.end() );
		reverse( b.begin(), b.end() );

		string::iterator it_a = a.begin();
		string::iterator it_b = b.begin();

		string kotae;
		int carry = 0;
		while ( it_a != a.end() || it_b != b.end() )
		{
			int an;
			int bn;
			if ( it_a != a.end() )
				an = ((*it_a) - '0');
			else
				an = 0;

			if ( it_b != b.end() )
				bn = ((*it_b) - '0');
			else
				bn = 0;

			int cn = an + bn + carry;
			if ( cn >= 10 )
			{
				carry = 1;
				cn %= 10;
				kotae += ('0' + cn);
			}
			else
			{
				carry = 0;
				kotae += ('0' + cn);
			}

			if ( it_a != a.end() )
				it_a++;
			if ( it_b != b.end() )
				it_b++;
		}

		if ( carry == 1 )
			kotae += '1';

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

		cout << kotae << endl;

	}

	return 0;
}