9721: Multiplication in base the Square Root of -2

内存限制:512 MB 时间限制:2 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

In this problem, you are asked to solve an easy task -- AAA multiplies BBB.

Let U= be the whole set where multiplications will be taken. Obviously, the product of any two elements in UUU is also an element in UUU.

Each element x∈Ux \in UxU can be represented in base  as a 01-string of length nnn in the form of , where x=  and when n>1n > 1n>1, cn−1=1c_{n - 1} = 1cn1=1. For example, −1+.

Your task is to calculate the product of two elements AAA and BBB of UUU in base  representation.

输入格式

The first line contains an integer TTT (1<=T<=105), indicating the number of test cases.
Then follow TTT test cases. For each test case:
The only line contains two 01-strings AAA and BBB .
It is guaranteed that the sum of (∣A∣+∣B∣)(|A| + |B|)(A+B) over TTT test cases does not exceed 2*106.

输出格式

For each test case, output a 01-string in one line, representing the product of AAA and BBB in base .

输入样例 复制

5
0 1
10 10
10 11
101 101
110 110

输出样例 复制

0
100
110
1
10110100

数据范围与提示

For the last test case of the example, .