[solution] Trick or treat, bags of sweets, ghosts are walking down the street solution codechef

Problem Solution codechef

Trick or treat, bags of sweets, ghosts are walking down the street

It’s Halloween and Suri Bhai is out to get his treats.
There are two sectors in his neighborhood, “Bones” and “Blood”. They have  and  people, respectively.

Each person in “Bones” will hand out  treats, and each person in “Blood” will hand out  treats.
How many treats does Suri Bhai get from visiting everyone in his neighborhood in total?

Input Format

  • The first line of input contains two space-separated integers  and  — the number of people in “Bones” and “Blood”, respectively.
  • The second line of input contains two space-separated integers  and  — the number of treats handed out by each person in “Bones” and “Blood”, respectively.

Output Format

For each test case output a single integer: the total number of treats Suri Bhai will receive.

Constraints

  • 0≤�,�≤100
  • 0≤�,�≤1000

Sample 1: [solution] Trick or treat, bags of sweets, ghosts are walking down the street solution codechef

Input

Output

4 2
5 6
32

Explanation:

  • “Bones” has 4 people, each of who will give out 5 treats, for a total of 4×5=20 treats.
  • “Blood” has 2 people, each of who will give out 6 treats, for a total of 2×6=12 treats.
  • The total number of treats is 20+12=32.

Sample 2: [solution] Trick or treat, bags of sweets, ghosts are walking down the street solution codechef

Input

Output

5 0
0 2
0

Explanation:

  • “Bones” has 5 people, each of who will give out 0 treats, for a total of 5×0=0 treats.
  • “Blood” has 0 people, each of who will give out 2 treats, for a total of 0×2=0 treats.
  • The total number of treats is 0+0=0.

Leave a Comment