Two Step


Submit solution

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

Author:
Problem types
Allowed languages
C, C++, Java, Python, Rust

INSPECTOR SHAHID: "There you are, detective. Thanks for coming in on a weekend for this. We've just had a report of a murder at Adelaide Town Hall.

An event by the Adelaide Competitive Programming Club appears to have gone badly wrong. One Kevin Lac was murdered backstage while preparing for the night. It was apparently his idea to host an 'ACPC Ball' celebrating the club's achievement of over 250 problems written.

The event was advertised as 'a night of good food, good music, and a speech section for our club to celebrate how far we've come.' Sounds like a lot of fun - if not for the murder.

Coroner puts time of death at approximately 5:45pm. Blunt force trauma to the top of the head, with localised inflammation and bruising. A metal edge of some kind. We pulled a fleck of anodised aluminium from the scalp. Grey-green, powder-coated.

We've identified twelve suspects, each with a different role in setting up the event:

  • Gleb Dubinin: moving equipment and technical setup
  • Jamie Mathieson: playlist and DJ duties for the night
  • Joshua Antony: filming the event for social media
  • Leslie Nguyen: proofread the speeches, prepared slides
  • Lukaz Solding: ensured AV for the speeches was perfect
  • Marcus Nguyen: created the posters and banners
  • Parsa Pordastan: a guest from MCPC, observing the event
  • Patrick Thompson: head chef, responsible for the night's food
  • Ritisha Nayyar: helped set up the posters and banners
  • Rory Peterson: co-organised the event with Kevin
  • Saadan Naqvi: set up the bar, responsible for the night's drinks
  • Zach Anderson: set up the photo station and memory wall

I've arranged interviews with all twelve of them: it's your job to find out who did it. The world of competitive programming is counting on you, detective. Good luck."

An evening at the Adelaide Town Hall, meant to be filled with mirth and celebrations, soured by the murder of ACPC's favourite member. To let Kevin rest peacefully, and to save the world of competitive programming, only one person is up to the task: the brilliant Detective Two Step!

The masses believe that this alias refers to how the detective is always two steps ahead of the culprit. They are wrong. The truth is much less flattering; an ironclad personal rule that the detective can only ever move in exactly two ways:

  • Moving forward exactly a steps
  • Moving backward exactly b steps

No exceptions: not even when someone's waiting on them.

And someone is. Inspector Shahid, the one who appointed Two Step to this case, is standing somewhere in the entrance corridor, waiting to fill them in on the details of the case. Two Step wants to get to the inspector, located d steps away, in exactly n moves, using some combination of their or backward moves. Is this possible?

Note: d is positive if the inspector is initially ahead of the detective and negative if they are behind them.

Input

The first line consists of two integers, a and b (1 \leq a, b\leq 10^9), where a represents the number of steps the detective takes when they move forward and b represents the number of steps the detective takes when they move backward.

The second line consists of two integers, n and d (0 \leq n \leq 10^5, -10^9 \leq d \leq 10^9), where n represents the number of moves and d represents the number of steps separating the detective and the inspector (positive if ahead, negative if behind).

Output

Output Yes if the detective can reach the inspector and No if they cannot.

Example

Input 1
2 3
5 5
Output 1
Yes

The detective can make 4 forward moves and 1 backwards move to reach the inspector.

Input 2
2 3
5 1
Output 2
No
Input 3
2 3
5 -10
Output 3
Yes

The detective can make 1 forward move and 4 backwards moves to reach the inspector.


Comments

There are no comments at the moment.