ANARC08E - Relax! It is just a game

You: What's the score? Did I miss much?

Me: It's 2-1 for elAhli and the second half just started. The first half was quite boring.

You: Who scored first? elAhli or ezZamalek?

Me: What difference does it make?

You: Big difference! I can predict the outcome of the match if I knew the order of which goals were scored in the first half.

Me: What do you mean?

You: It's 2-1 for elAhli, right? One of three things could have happened: elAhli scored two goals then ezZamalek scored; Or, elAhli scored its first goal, then ezZamalek, then elAhli again; Or, ezZamalek scored first, then elAhli scored its two goals.

Me: So?!! I still don't understand what difference does that make? It's still 2-1 for elAhli! Why don't you just relax and let us continue watching the game in peace.

You: You don't understand!! I believe the probability of who'll win depends on the order of how goals were scored. Now I have to predict the outcome for 3 possibilities.

Me: And what if the score was 3-2? What would you have done then?

You: I would have to work for 5 different possibilities. No?

Me: Of course not! The number of possibilities isn't always equal to the sum.

You: Can you tell me when will it be equal to the sum?

Me: You're a programmer, why don't you write a program that counts the number of possibilities and compare it to the sum?

You: I don't have the time, I want to watch the match. Besides, I have nine other problems to worry about.

Me: I'll give you a hint. The possibilities will be equal to the sum only if one of the teams scored a certain number of goals.

Input

Your program will be tested on one or more test cases. Each test case specifies two natural numbers (A and B ) (separated by one or more spaces) representing the score of the first half. No team will be able to score more than 10 goals. The last line of the input file contains two -1's (which is not part of the test cases.)

Output

Format For each test case where the number of possibilities is equal to the sum, print:

A+B=C

Where A and B are as above and C is their sum. If the number of possibilities is not equal to the sum, replace the '=' sign with '!=' (without the quotes.)

Example

Input:
2 1
1 0
-1 -1

Output:
2+1=3
1+0=1

Added by:Ahmed Aly
Date:2009-07-04
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:ANARC 2008

hide comments
2011-10-18 16:32:39 kushagra
@Keshav Bisarwal
for 0 0 ans=0+0!=0
for 5 3 ans=5+3!=8
only one line is important read it carefully!!!
i got it!


Last edit: 2011-10-18 16:33:57
2011-09-28 15:53:13 Rachmawan Atmaji Perdana
Oh my this is an ACM contest problem...XD
2011-09-17 08:19:05 Keshav Bisarwal
What will be the output for
0 0
5 3
2011-09-09 14:40:21 Rohmad Raharjo
What a tricky problem...
But solved.. :D
2011-07-24 21:35:14 manohar
This is a NP-hard problem :D :D :P :P
2011-04-20 09:27:29 Danav
Lol @Chandra Sekar,posting solutions isn't allowed ;-)

Last edit: 2011-04-20 09:27:50
2011-04-16 07:53:05 Dulguun
LoL. Just read Chandra Sekar's comment. :D
2011-03-20 23:47:33 nagesh
Easiest problem...!!!
Get the important line frm Problem!! :)
2011-02-23 19:31:01 Mohamed Naguib
@Chandra Sekar
I solved the problem from your comment :)
2011-02-10 12:10:42 spoj user
there is no great coding in this problem
:)
just read the question carefully
and get the most important line.
ITS A REALLY STUPID PROBLEM
NICE Chandra Sekar :)

Last edit: 2011-02-10 12:12:12
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.