## Snowball Fight

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Two people are having a fun snowball fight. The fight begins with both people throwing a snowball at each other at the same time. After the -th person throws a snowball, it takes seconds before they throw another. Every snowball that is thrown will hit the other person. If the -th person is hit by at least snowballs, they will give up. If both people give up at the same time, the fight is a tie. Otherwise, the remaining person is declared the winner. What will be the outcome of the fight?

#### Input Specification

The input consists of two lines. The first line contains two space-separated integers and . The second line contains two space-separated integers and .

#### Output Specification

Output a single integer: if the first person wins, if the second person wins, or if the fight is a tie.

#### Sample Input 1

2 3
2 4

#### Output for Sample Input 1

1

#### Explanation for Output for Sample Input 1

The first person is able to throw their second snowball after 3 seconds, forcing the second person to give up before they can throw their second snowball.

#### Sample Input 2

3 4
4 6

#### Output for Sample Input 2

-1

#### Explanation for Output for Sample Input 2

At seconds, the first person throws their second snowball.
At seconds, the second person throws their second snowball. At seconds, the first person throws their third snowball.
At seconds, both players throw another snowball. The first person is hit by snowballs, and the second hit by , thus both give up at the same time.