SP3023 MUL2COM - Binary multiplication

Description

[English](/problems/MUL2COM/en/) [Vietnamese](/problems/MUL2COM/vn/)In this problem, you have to multiply two n-bit binary numbers in 2s complement form. The result should be also a n-bit binary number in 2s complement form. In case there is an arithmetic overflow, you program should be able to detect it. For your information, the 2s complement form of -x is the number 2^n-x. A n-bit 2s complement number ranges from -2 $ ^{n-1} $ to 2 $ ^{n-1} $ -1.

Input Format

There are multiple test cases (no more than 40). For each test case, there are three input lines. The first line contains n (0 ≤ n ≤ 1024). n=0 signals the end of the input. Otherwise, the second and third lines contain the two n-bit binary numbers.

Output Format

For each test case, output "overflow" if there is an arithmetic overflow. Otherwise, print the result in 2s complement form.