## A Plus B (Hard)

View as PDFXyene's teacher realized that he was cheating, and was using the code you wrote to save his marks. So, the math teacher decided that he will mess up your program by using numbers larger than . In fact, he will give problems involving addition of -digit numbers as punishment. However, Xyene is once again on top — he has promised you a "reward" if you help him again. You suspect it might not be anything more than 15 points, but you still have your hopes up...

#### Input Specification

The first line will contain an integer , the number of addition problems Xyene needs to do. The next lines will each contain two space-separated integers with up to digits in decimal, the two integers Xyene needs to add. will never be greater than . Warning: the test cases are a lot more sadistic than the sample.

#### Output Specification

Output lines, the solutions to the addition problems in order.

#### Sample Input

```
4
1 1
226077045628835347875 -572260769919042128358
-803119834418378628674 236083700054616110639
-435599336891761067707 451767479989987922363
```

#### Sample Output

```
2
-346183724290206780483
-567036134363762518035
16168143098226854656
```

## Comments

But why isn't python2 and lua allowed :v(

The difficulty of this in Python is the same as the regular aplusb (i.e. not worth 15 points). I've enabled Lua.

@DuckyDigs stop trolling you should be banned

my machine took few milliseconds to progress and your machine said it took more than 5 seconds

anybody know why???

Because copy/pasting code from Java's

`BigInteger`

implementation was never intended as a correct solution to this problem.`BigInteger`

isexplicitlydisallowed, so why would copypasta of it be any different?<strike>The hard part seems to be parsing the input. It's really annoying to get a string that large from base 10 to base 2 (and back).</strike> The solution seems to be to just not do it...

Java is now allowed for this problem, though use of the

`BigInteger`

and`BigDecimal`

classes is disallowed.Cuz it can't even handle 2^64.

Why can't we use java?

Judging by the GitHub page, Java could soon be allowed for this question, just with BigIntegers disabled.

P.S. Xyene, you're also going to disable BigDecimal...right?

Yes,

`BigDecimal`

would be disabled. Support for disallowing big math is implemented judge-side, but it will likely be a while before we get to adding any kind of support for it on the site.Use Java？It's to simple.

too young too simple sometimes naive

Welcome to reality my friend

http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#add(java.math.BigInteger)

tried so many cases nothing seems to give me the wrong answer. any suggestions?

And please don't beef me, I need them 15 points.

The difficulty of this in Java is the same as the regular aplusb (i.e. not worth 15 points).

It is pretty hard...

he refers to Big Integers

Awww :(