using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static long d(long sx,long sy,long gx,long gy)
        {
            return Math.Abs(gx - sx) + Math.Abs(gy - sy);
        }
      



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var abcxy = Reads();
            if (abcxy[0] + abcxy[1] > 2 * abcxy[2])
            {
                if (abcxy[0] < 2 * abcxy[2] && abcxy[1] < 2 * abcxy[2])
                {
                    if (abcxy[3] > abcxy[4])
                        Console.WriteLine(2 * abcxy[2] * abcxy[4] + (abcxy[3] - abcxy[4]) * abcxy[0]);
                    else
                        Console.WriteLine(2 * abcxy[2] * abcxy[3] + (abcxy[4] - abcxy[3]) * abcxy[1]);
                }
                else if (abcxy[0] > 2 * abcxy[2] && abcxy[1] < 2 * abcxy[2])
                {
                    if (abcxy[3] > abcxy[4])
                        Console.WriteLine(2 * abcxy[2] * abcxy[3]);
                    else
                        Console.WriteLine(2 * abcxy[2] * abcxy[3] + (abcxy[4] - abcxy[3]) * abcxy[1]);
                }
                else if(abcxy[0] < 2 * abcxy[2] && abcxy[1] > 2 * abcxy[2])
                {
                    if (abcxy[3] > abcxy[4])
                        Console.WriteLine(2 * abcxy[2] * abcxy[4]+ (abcxy[3] - abcxy[4]) * abcxy[0]);
                    else
                        Console.WriteLine(2 * abcxy[2] * abcxy[4]);
                }
                else if(abcxy[0] > 2 * abcxy[2] && abcxy[1] > 2 * abcxy[2])
                {
                    Console.WriteLine(2 * abcxy[2] * Math.Max(abcxy[3], abcxy[4]));
                }
            }
            else
            {
                Console.WriteLine(abcxy[0] * abcxy[3] + abcxy[1] * abcxy[4]);
            }
             

            Console.Out.Flush();
        }
    }
}


