EMP - University Employees

On some island each inhabitant is either a knight who only tells the truth, or a liar who always lies. Also, on the island there exists a university of technology where some of the inhabitants work. All of the university employees will always tell you the following two things, no matter which employee you ask:

1. There are fewer than N employees who work more than me.


2. At least M employees of the university have a larger salary than me.


It is also known that no two employees of the university have an identical salary, and no two work equally. Write a program which will compute how many persons are employed by this university.

Input

The only input line contains two integers N and M, with one space between them [N, M <= 1000000000].

Output

The output must contain only one integer - the total number of employees of this university, or 0 if there is no way to find the number of employees.

Example

Input:
1 1

Output:
2

Author: Filimonenkov D.O.


Added by:Roman Sol
Date:2006-04-24
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:ZCon 2007

hide comments
2015-11-06 12:05:18 avidcoder
Don't trust any employee. But always trust one.
2015-07-14 21:26:43 scyth3r
1 line of code in python :D :D
2014-12-11 09:46:55 agaurav77
The language is unclear. Does working more mean more salary? I got AC but I think the question's first fact should have "fewer or equal to N" instead of "fewer than N".

Last edit: 2014-12-11 09:47:22
2014-07-10 12:14:20 atom
WTF Awesome logic...the best question ever...100 LOC
2014-01-08 16:47:50 Samil Vargas
[spoiler removed]

Last edit: 2014-01-08 18:49:36
2013-08-21 02:38:36 (Tjandra Satria Gunawan)(曾毅昆)
too easy, even for brainf**k :-P
2013-02-12 16:09:58 ~ignited~
bekar..... waste of time...
2013-01-24 05:44:17 Unnati Gupta
4 lines of code in Python..
2012-07-03 18:30:48 saket diwakar
PROBLEM MUST BE DELETED.
2012-06-27 07:21:23 Fish3R
Easiest Question... :D
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.