Number of chocolates
Practice
3.6 (32 votes)
Basic programming
Basic math
Basics of implementation
Implementation
Math basic
Arithmetic operations
Math
Problem
95% Success 2443 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

The number of chocolates that Alice is losing per day is \(D1\). Whereas, the number of chocolates that Bob is gaining per day is \(D2\). Currently, the number of chocolates that Alice and Bob contains is \(A\) and \(B\) respectively.

You are required to calculate the number of chocolates that Alice has when Bob does not contain any chocolates. 

Note

  • In any case, Alice always loses all the chocolates.
  • \(A\%D1=0\)

Input format

The first and only line contains four space-separated integers \(A\), \(B\), \(D1\), and \(D2\).

Output format

Print a single integer denoting the number of chocolates that Bob contains.

Note: It is guaranteed that the answer always exists.

Constraints

\(1\le A,\ B \le10^3\\ 1\le D1,\ D2\le10^3\\ 1\le D1\le A\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
10 votes
Tags:
Math BasicAlgorithmsBasic MathMath
Points:10
17 votes
Tags:
MathematicsBasic MathMath
Points:10
1 votes
Tags:
Basic MathC++MathObservation