This page is still under construction.

Parts of this page are still being built. What you see may change.

Hard to Believe, but True!

Time limit1sMemory limit128 MB

Summary
Read the numbers in each equation backwards, add them, and check whether the sum equals the backwards-read result.
Level

Easy2 of 10

Topics
String, Math, Implementation
Solved
No attempts yet

Problem

The fight goes on over whether to store numbers starting with their most significant digit or their least significant digit. This is sometimes called the "Endian War", and its battleground reaches far back into the early days of computer science. Joe Stoy, in his (by the way, excellent) book "Denotational Semantics", tells the following story:

"The decision which way round the digits run is, of course, mathematically trivial. Indeed, one early British computer had numbers running from right to left (because the spot on an oscilloscope tube runs from left to right, but in serial logic the least significant digits are dealt with first). Turing used to mystify audiences at public lectures when, quite by accident, he would slip into this mode even for decimal arithmetic, and write things like 73+42=16. The next version of the machine was made more conventional simply by crossing the x-deflection wires; this, however, worried the engineers, whose waveforms were all backwards. That problem was in turn solved by providing a little window so that the engineers (who tended to be behind the computer anyway) could view the oscilloscope screen from the back.

[C. Strachey - private communication.]"

You will play the role of the audience and judge the truth value of Turing's equations.

Input

The input contains several test cases. Each specifies a Turing equation on a single line. A Turing equation has the form "a+b=c", where a, b, c are numbers made up of the digits 0, ..., 9. Each number consists of at most 7 digits, including any leading or trailing zeros. The equation "0+0=0" finishes the input and must be processed as well. The equations contain no spaces.

Output

For each test case, output a single line containing the word "True" or the word "False", according to whether the equation is true or false in Turing's interpretation, i.e. with the numbers read backwards.

Examples1

  1. Example 1

    Input
    73+42=16
    5+8=13
    10+20=30
    0001000+000200=00030
    1234+5=1239
    1+0=0
    7000+8000=51
    0+0=0
    
    Expected output
    True
    False
    True
    True
    False
    False
    True
    True