AT_abc428_a [ABC428A] Grandma's Footsteps

Description

Takahashi is enjoying a game at school. The game starts at the moment the bell rings. Immediately after the bell rings, he repeats the following actions: - Run at a speed of $ S $ meters per second for $ A $ seconds. Then, remain stationary for $ B $ seconds. How many meters in total does he run by the time $ X $ seconds have elapsed since the bell rang?

Input Format

The input is given from Standard Input in the following format: > $ S $ $ A $ $ B $ $ X $

Output Format

Output the answer in one line. Omit the unit (meters) in the output.

Explanation/Hint

### Sample Explanation 1 During the $ 11 $ seconds after the bell rings, Takahashi moves as follows: - From $ 0 $ seconds to $ 3 $ seconds, he runs at a speed of $ 7 $ meters per second. The distance traveled during this time is $ 21 $ meters. - From $ 3 $ seconds to $ 5 $ seconds, he remains stationary. - From $ 5 $ seconds to $ 8 $ seconds, he runs at a speed of $ 7 $ meters per second. The distance traveled during this time is $ 21 $ meters. - From $ 8 $ seconds to $ 10 $ seconds, he remains stationary. - From $ 10 $ seconds to $ 11 $ seconds, he runs at a speed of $ 7 $ meters per second. The distance traveled during this time is $ 7 $ meters. The total distance traveled is $ 49 $ meters, so output $ 49 $ . ### Sample Explanation 2 During the $ 9 $ seconds after the bell rings, Takahashi moves as follows: - From $ 0 $ seconds to $ 3 $ seconds, he runs at a speed of $ 6 $ meters per second. The distance traveled during this time is $ 18 $ meters. - From $ 3 $ seconds to $ 5 $ seconds, he remains stationary. - From $ 5 $ seconds to $ 8 $ seconds, he runs at a speed of $ 6 $ meters per second. The distance traveled during this time is $ 18 $ meters. - From $ 8 $ seconds to $ 9 $ seconds, he remains stationary. The total distance traveled is $ 36 $ meters, so output $ 36 $ . ### Sample Explanation 3 During the $ 428 $ seconds after the bell rings, Takahashi moves as follows: - From $ 0 $ seconds to $ 1 $ second, he runs at a speed of $ 1 $ meter per second. The distance traveled during this time is $ 1 $ meter. - From $ 1 $ second to $ 428 $ seconds, he remains stationary. The total distance traveled is $ 1 $ meter, so output $ 1 $ . ### Constraints - $ 1 \leq S \leq 15 $ - $ 1 \leq A \leq 1000 $ - $ 1 \leq B \leq 1000 $ - $ 1 \leq X \leq 1000 $ - All input values are integers.