Government discount
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
The people are unhappy with what is happening in the country. Therefore, Zenyk, who works in the government, decided to issue an order for a discount on buckwheat.
Previously, one pack of buckwheat cost \(a\) hryvnias, now, according to the new order, two packs can be bought for \(b\) hryvnias.
The people became curious about how many hryvnias they will save by buying two packs of buckwheat.
Input
The single line contains two integers \(a\), \(b\) — the price of one pack and the price of two packs with the discount, respectively.
Output
In the single line, print a single integer — the number of hryvnias saved.
Constraints
\(1 \le a, b \le 10^6\),
\(b \le 2\cdot a\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 4 7 | 1 |
| Input (stdin) | Output (stdout) |
|---|---|
| 7 4 | 10 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
Government discount - Editorial
Two packs of buckwheat cost \(2 \cdot a\) without the discount and \(b\) with it. So we save \(2 \cdot a - b\).
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|