This page is still under construction.

Parts of this page are still being built. What you see may change.

Bicycle

Interview

Time limit2sMemory limit512 MB

Summary
For each of two bike rental plans, compute the monthly cost over 21 working days given a daily riding time T and per-minute overage rates.
Level

Easy2 of 10

Topics
Math, Implementation, Simulation
Solved
No attempts yet

Problem

After spending a long time at home during the quarantine, in November you decided to commute to work by bicycle. You do not own a bicycle, so you have to rent one. The rental service offers two monthly plans:

  • The monthly fee is aa roubles. Each day the first 3030 minutes are free, and every minute beyond that costs xx roubles.
  • The monthly fee is bb roubles. Each day the first 4545 minutes are free, and every minute beyond that costs yy roubles.

November has 2121 working days, and you spend TT minutes in total on the bicycle each day commuting to work and back home. Calculate how many roubles you would spend under each of the two monthly plans.

Input

The first four lines contain the integers aa, xx, bb, and yy (0≤a,x,b,y≤1000 \leq a, x, b, y \leq 100), one per line. The last line contains a single integer TT (1≤T≤14401 \leq T \leq 1440), the total time spent on the bicycle each day.

Output

Print a single line with two integers: the amount of money you would spend on the first plan and on the second plan, in that order.

Examples3

  1. Example 1

    Input
    10
    1
    20
    5
    50
    
    Expected output
    430 545
    
  2. Example 2

    Input
    10
    10
    10
    10
    42
    
    Expected output
    2530 10
    
  3. Example 3

    Input
    10
    10
    10
    10
    27
    
    Expected output
    10 10