Number of chocolates
Tag(s):

## Arithmetic operations, Basic Math, Basic Programming, Basics of Implementation, Implementation, Math, Math Basic

Problem
Editorial
Analytics

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$

SAMPLE INPUT
100 10 5 100
SAMPLE OUTPUT
2010
Explanation

Initially, Mr. A has 100 chocolates and Mr.B has 10 chocolates and it is given that Mr.A is losing 5 chocolates per day so it will take 20 days from today to become poor and in these 20 days Mr.B  will gain 100*20 =2000 chocolates so Mr.B chocolates become 2010.

Time Limit: 1,0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

October Easy' 19

OTHER PROBLEMS OF THIS CHALLENGE
• Math > Number Theory
• Math > Basic Math
• Algorithms > Graphs
• Algorithms > Dynamic Programming
Уведомления

?