/* HDU 2096 小明A+B --- 水题 */
#include <cstdio> int main()
{
#ifdef _LOCAL
freopen("D:\\input.txt", "r", stdin);
#endif
int a, b, c, n;
scanf("%d", &n);
while (n--){
scanf("%d%d", &a, &b);
a %= ;
b %= ;
c = a + b;
c %= ;
printf("%d\n", c);
} return ;
}