using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Debug = System.Diagnostics.Trace;
using SB = System.Text.StringBuilder;
using static System.Math;
using Number = System.Int32;
using System.Numerics;

namespace Program {
	public class Solver {
		Random rnd = new Random();
		public void Solve() {
			var a = ri;
			var b = ri;
			var c = ri;
			var d = ri;

			var x = ri;
			var y = ri;
			var max = 0L;
			for (int i = 0; i <= d; i++) {
				if (a < i) break;
				var v = x * i;
				v += y * new int[] { b, c, d - i }.Min();
				Debug.WriteLine(i);
				Debug.WriteLine(v);
				max = Max(max, v);
			}
			Console.WriteLine(max);
		}

		const long INF = 1L << 60;
		static int[] dx = { -1, 0, 1, 0 };
		static int[] dy = { 0, 1, 0, -1 };
		int ri { get { return sc.Integer(); } }
		long rl { get { return sc.Long(); } }
		double rd { get { return sc.Double(); } }
		string rs { get { return sc.Scan(); } }
		public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());

		static T[] Enumerate<T>(int n, Func<int, T> f) {
			var a = new T[n];
			for (int i = 0; i < a.Length; ++i) a[i] = f(i);
			return a;
		}
		static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
	}
}

#region main
static class Ex {
	static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
	static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
		return string.Join(st, ie);
	}
	static public void Main() {
		Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = true });
		var solver = new Program.Solver();
		//*
		var t = new System.Threading.Thread(solver.Solve, 50000000);
		t.Start();
		t.Join();
		//*/
		// solver.Solve();
		Console.Out.Flush();
	}
}
#endregion
#region Ex
namespace Program.IO {
	using System.IO;
	using System.Text;
	using System.Globalization;

	public class Printer : StreamWriter {
		public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
		public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
	}

	public class StreamScanner {
		public StreamScanner(Stream stream) { str = stream; }

		public readonly Stream str;
		private readonly byte[] buf = new byte[1024];
		private int len, ptr;
		public bool isEof = false;
		public bool IsEndOfStream { get { return isEof; } }

		private byte read() {
			if (isEof) return 0;
			if (ptr >= len) {
				ptr = 0;
				if ((len = str.Read(buf, 0, 1024)) <= 0) {
					isEof = true;
					return 0;
				}
			}
			return buf[ptr++];
		}

		public char Char() {
			byte b = 0;
			do b = read(); while ((b < 33 || 126 < b) && !isEof);
			return (char)b;
		}
		public string Scan() {
			var sb = new StringBuilder();
			for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);
			return sb.ToString();
		}
		public string ScanLine() {
			var sb = new StringBuilder();
			for (var b = Char(); b != '\n' && b != 0; b = (char)read()) if (b != '\r') sb.Append(b);
			return sb.ToString();
		}
		public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
		public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
		public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
	}
}

#endregion

using System;
using System.Linq;
using CompLib.Util;
using System.Threading;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int[] a = new int[6];
        for (int i = 0; i < 6; i++)
        {
            a[i] = sc.NextInt();
        }

        long ans = 0;
        // eに使うジャケット
        for (int g = 0; g <= a[3]; g++)
        {
            int cntE = Math.Min(a[0], g);
            int cntF = Math.Min(a[1], Math.Min(a[2], a[3] - g));

            ans = Math.Max(ans, cntE * a[4] + cntF * a[5]);
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using static System.Array;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;
    private readonly TextWriter output;

    public void Solve()
    {
      // var t = input.ReadInt();
      // var ans = new List<int>(t);
      // for (int _ = 0; _ < t; _++)
      // {
        var (a, b,c,d) = input.Read4Int();
        var (e, f) = input.Read2Int();
        int ce, cf;
        if (e > f)
        {
          ce = Min(a, d);
          d -= ce;
          cf = Min(b, Min(c, d));
        }
        else
        {
          cf = Min(b, Min(c, d));
          d -= cf;
          ce = Min(a, d);
        }
        var s = ce * e + cf * f;
        output.Write(s);
      // }
      // output.WriteLine(string.Join(Environment.NewLine, ans));
    }

    public ProblemSolver(TextReader input, TextWriter output)
    {
      this.input = new Tokenizer(input);
      this.output = output;
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private readonly TextReader reader;

    private readonly StringBuilder tokenBuilder = new StringBuilder();

    public string ReadToEnd() => reader.ReadToEnd();

    public int ReadInt()
    {
      var c = SkipWs();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }

      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");

      checked
      {
        var result = (char)c - '0';
        c = reader.Read();
        while (c > 0 && !char.IsWhiteSpace((char)c))
        {
          if (!char.IsDigit((char)c))
            throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
          result = result * 10 + (char)c - '0';
          c = reader.Read();
        }

        if (isNegative)
          result = -result;
        return result;
      }
    }

    public string ReadLine() => reader.ReadLine();

    public long ReadLong() => long.Parse(ReadToken());

    public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);

    public (int, int) Read2Int() => (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public (long, long) Read2Long() => (ReadLong(), ReadLong());

    public int[] ReadIntArray(int n) => ReadArray(n, ReadInt);

    public long[] ReadLongArray(int n) => ReadArray(n, ReadLong);

    public double[] ReadDoubleArray(int n) => ReadArray(n, ReadDouble);

    public string ReadToken()
    {
      var c = SkipWs();
      if (c == -1)
        return null;
      tokenBuilder.Clear();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        tokenBuilder.Append((char)c);
        c = reader.Read();
      }
      return tokenBuilder.ToString();
    }

    private int SkipWs()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    private static T[] ReadArray<T>(int n, Func<T> readFunc)
    {
      var a = new T[n];
      for (var i = 0; i < n; i++)
        a[i] = readFunc();
      return a;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal static class Program
  {
    private const int BufferSize = 1024 * 10;

    public static void Main()
    {
      using var reader = new StreamReader(OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
      using var writer = new StreamWriter(OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize);
      var solver = new ProblemSolver(reader, writer);
      solver.Solve();
    }
  }

  #endregion
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CodeforcesRound608Div2.Questions;

namespace CodeforcesRound608Div2.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override void Solve(IOManager io)
        {
            var ties = io.ReadInt();
            var scarves = io.ReadInt();
            var vests = io.ReadInt();
            var jackets = io.ReadInt();
            var firstCost = io.ReadInt();
            var secondCost = io.ReadInt();

            var max = 0;

            for (int jacketFirst = 0; jacketFirst <= jackets; jacketFirst++)
            {
                var first = Math.Min(ties, jacketFirst);
                var second = Math.Min(Math.Min(scarves, vests), jackets - jacketFirst);
                max.ChangeMax(first * firstCost + second * secondCost);
            }

            io.WriteLine(max);
        }
    }
}

namespace CodeforcesRound608Div2
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();
            using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());
            question.Solve(io);
        }
    }
}

#region Base Class

namespace CodeforcesRound608Div2.Questions
{
    public interface IAtCoderQuestion
    {
        string Solve(string input);
        void Solve(IOManager io);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public string Solve(string input)
        {
            var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));
            var outputStream = new MemoryStream();
            using var manager = new IOManager(inputStream, outputStream);

            Solve(manager);
            manager.Flush();

            outputStream.Seek(0, SeekOrigin.Begin);
            var reader = new StreamReader(outputStream);
            return reader.ReadToEnd();
        }

        public abstract void Solve(IOManager io);
    }
}

#endregion

#region Utils

namespace CodeforcesRound608Div2
{
    public class IOManager : IDisposable
    {
        private readonly BinaryReader _reader;
        private readonly StreamWriter _writer;
        private bool _disposedValue;
        private byte[] _buffer = new byte[1024];
        private int _length;
        private int _cursor;
        private bool _eof;

        const char ValidFirstChar = '!';
        const char ValidLastChar = '~';

        public IOManager(Stream input, Stream output)
        {
            _reader = new BinaryReader(input);
            _writer = new StreamWriter(output) { AutoFlush = false };
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private char ReadAscii()
        {
            if (_cursor == _length)
            {
                _cursor = 0;
                _length = _reader.Read(_buffer);

                if (_length == 0)
                {
                    if (!_eof)
                    {
                        _eof = true;
                        return char.MinValue;
                    }
                    else
                    {
                        ThrowEndOfStreamException();
                    }
                }
            }

            return (char)_buffer[_cursor++];
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public char ReadChar()
        {
            char c;
            while (!IsValidChar(c = ReadAscii())) { }
            return c;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public string ReadString()
        {
            var builder = new StringBuilder();
            char c;
            while (!IsValidChar(c = ReadAscii())) { }

            do
            {
                builder.Append(c);
            } while (IsValidChar(c = ReadAscii()));

            return builder.ToString();
        }

        public int ReadInt() => (int)ReadLong();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long ReadLong()
        {
            long result = 0;
            bool isPositive = true;
            char c;

            while (!IsNumericChar(c = ReadAscii())) { }

            if (c == '-')
            {
                isPositive = false;
                c = ReadAscii();
            }

            do
            {
                result *= 10;
                result += c - '0';
            } while (IsNumericChar(c = ReadAscii()));

            return isPositive ? result : -result;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private Span<char> ReadChunk(Span<char> span)
        {
            var i = 0;
            char c;
            while (!IsValidChar(c = ReadAscii())) { }

            do
            {
                span[i++] = c;
            } while (IsValidChar(c = ReadAscii()));

            return span.Slice(0, i);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public double ReadDouble() => double.Parse(ReadChunk(stackalloc char[32]));

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public decimal ReadDecimal() => decimal.Parse(ReadChunk(stackalloc char[32]));

        public int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }

        public long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }

        public double[] ReadDoubleArray(int n)
        {
            var a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadDouble();
            }
            return a;
        }

        public decimal[] ReadDecimalArray(int n)
        {
            var a = new decimal[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadDecimal();
            }
            return a;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteLine<T>(T value) => _writer.WriteLine(value.ToString());

        public void WriteLine<T>(IEnumerable<T> values, char separator)
        {
            var e = values.GetEnumerator();
            if (e.MoveNext())
            {
                _writer.Write(e.Current.ToString());

                while (e.MoveNext())
                {
                    _writer.Write(separator);
                    _writer.Write(e.Current.ToString());
                }
            }

            _writer.WriteLine();
        }

        public void WriteLine<T>(Span<T> values, char separator) => WriteLine((ReadOnlySpan<T>)values, separator);

        public void WriteLine<T>(ReadOnlySpan<T> values, char separator)
        {
            for (int i = 0; i < values.Length - 1; i++)
            {
                _writer.Write(values[i]);
                _writer.Write(separator);
            }

            if (values.Length > 0)
            {
                _writer.Write(values[^1]);
            }

            _writer.WriteLine();
        }

        public void Flush() => _writer.Flush();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static bool IsNumericChar(char c) => ('0' <= c && c <= '9') || c == '-';

        private void ThrowEndOfStreamException() => throw new EndOfStreamException();

        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _reader.Dispose();
                    _writer.Flush();
                    _writer.Dispose();
                }

                _disposedValue = true;
            }
        }

        public void Dispose()
        {
            Dispose(disposing: true);
            GC.SuppressFinalize(this);
        }
    }

    public static class UtilExtensions
    {
        public static void ChangeMax<T>(ref this T a, T b) where T : struct, IComparable<T>
        {
            if (a.CompareTo(b) < 0)
            {
                a = b;
            }
        }

        public static void ChangeMin<T>(ref this T a, T b) where T : struct, IComparable<T>
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
            }
        }

        public static void Sort<T>(this T[] array) where T : IComparable<T> => Array.Sort(array);
        public static void Sort<T>(this T[] array, Comparison<T> comparison) => Array.Sort(array, comparison);
    }
}

#endregion

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

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());
            int f = int.Parse(Console.ReadLine());
            long price = 0;
            int first = 0;
            int second = 0;
            if (f >= e)
            {
                second = Math.Min(b, (Math.Min(c, d)));
                d -= second; b -= second; c -= second;
                first = Math.Min(a, d);
                a -= first; d -= first;
            }
            else
            {
                first = Math.Min(a, d);
                a -= first; d -= first;
                second = Math.Min(b, (Math.Min(c, d)));
                d -= second; b -= second; c -= second;
            }
            price = first * e + second * f;

            Console.WriteLine(price);

            //   Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace suits2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d, e, f;

            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());
            c = Convert.ToInt32(Console.ReadLine());
            d = Convert.ToInt32(Console.ReadLine());
            e = Convert.ToInt32(Console.ReadLine());
            f = Convert.ToInt32(Console.ReadLine());

            int m = Math.Min(b, Math.Min(c, d));
            int all = m * f + e * Math.Min(a, d - m);

            int x = Math.Min(a, d);
            int y = x * e + f * Math.Min(b, Math.Min(c, d - x));

            int vegleges = Math.Max(y, all);

            Console.WriteLine(vegleges);
        }
    }
}

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

namespace cf608
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_cf608A();
        }

        public static void solve_cf608B()
        {

        }

        public static void solve_cf608A()
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());
            int ans = 0;
            if (f > e)
            {
                int df = Math.Min(Math.Min(b, d), Math.Min(c, d));
                ans = df * f;
                d = d - df;
                ans += e * Math.Min(d, a);
            }
            else
            {
                int de = Math.Min(a, d);
                ans = de * e;
                d = d - de;
                ans += f * Math.Min(Math.Min(b, d), Math.Min(c, d));
            }
            Console.WriteLine(ans);
        }
    }
}

using System;
using System.Text;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int a = sc.NextInt(); //1
        int b = sc.NextInt(); //2
        int c = sc.NextInt(); //2
        int d = sc.NextInt(); //12
        int e = sc.NextInt();
        int f = sc.NextInt();

        long ans = 0;
        for (int type1 = 0; type1 <=d ; type1++)
        {
            int type2 = d - type1;

            long t = Math.Min(type1, a) * e + Math.Min(Math.Min(type2,b),c)*f;
            ans = Math.Max(ans, t);
        }
        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problems
{
    class Problems
    {

        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());

            int suitsCost = 0;
            if (e > f)
            {
                int suits1 = Math.Min(a, d);
                suitsCost = suits1*e + Math.Min(d - suits1, Math.Min(b, c))*f;
            }
            else
            {
                int suits2 = Math.Min(d, Math.Min(b, c));
                suitsCost = suits2*f + Math.Min(d - suits2, a)*e;
            }
            Console.WriteLine(suitsCost);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class A1271_Suits
    {
        public static void Main()
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());
            int f = int.Parse(Console.ReadLine());

            int[] array = new int[3];
            decimal totalSuit1 = 0;
            decimal totalSuit2 = 0;

            if (e > f)
            {
                if (a > d)
                {
                    totalSuit1 = d * e;
                    a -= d;
                    d = 0;
                }
                else
                {
                    totalSuit1 = a * e;
                    d -= a;
                }
                array[0] = b;
                array[1] = c;
                array[2] = d;
                Array.Sort(array);
                totalSuit2 = f * array[0];
            }
            else {
                array[0] = b;
                array[1] = c;
                array[2] = d;
                Array.Sort(array);
                totalSuit2 = f * array[0];

                d -= array[0];

                if (a > d)
                {
                    totalSuit1 = d * e;
                    a -= d;
                }
                else
                {
                    totalSuit1 = a * e;
                    d -= a;
                }
            }

                Console.WriteLine(totalSuit2+totalSuit1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test_codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d, e, f;
            a = int.Parse( Console.ReadLine() );
            b = int.Parse(Console.ReadLine());
            c = int.Parse(Console.ReadLine());
            d = int.Parse(Console.ReadLine());
            e = int.Parse(Console.ReadLine());
            f = int.Parse(Console.ReadLine());

            if (e > f)
            {
                int delim = Math.Min(a, d);
                int ans = delim * e;
                if (delim != d)
                {
                    d -= a;
                    delim = Math.Min(b, Math.Min(c, d));
                    ans += delim * f;
                }
                Console.WriteLine(ans);
            }else
            {
                int delim = Math.Min(b, Math.Min(c, d));
                int ans = delim * f;
                if (delim != d)
                {
                    d -= delim;
                    delim = Math.Min(a, d);
                    ans += delim * e;
                }
                Console.WriteLine(ans);
            }
            //Console.ReadKey();

        }
    }
}

using System;
using System.IO;
using System.Numerics;

class Program
{

    /* Input Methoden :
     *
     * Integer: int n = int.Parse(Console.ReadLine());
     * String:  String n = Console.ReadLine();
     * Integer Array: int[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt32(r)).ToArray();
     * String Array:  String[] input = Console.ReadLine().Split(' ');
     *
     * --- Datenstrukturen:
     *   List<Int16> list = new List<Int16>();
     *   HashSet<int> hset = new HashSet<int>();
     *         Dictionary<int, int> dict = new Dictionary<int, int>();
     *
     *
     * Ausgabe: Console.WriteLine();
     *
     *
     *
     */
    static void Main(string[] args)
    {
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = int.Parse(Console.ReadLine());
        int d = int.Parse(Console.ReadLine());
        int e = int.Parse(Console.ReadLine());
        int f = int.Parse(Console.ReadLine());
        long cost = 0;

        if (e >= f) {

            int s = Math.Min(a,d);
            cost += e * s;

            d -= s;

            if (d > 0) {

                s = Math.Min(Math.Min(b,c),d);
                cost += f * s;

            }

        }
        else {

            int s = Math.Min(Math.Min(b, c), d);
            cost += f * s;

            d -= s;

            if (d > 0) {
                 s = Math.Min(a, d);
                 cost += e * s;

            }

        }

        Console.WriteLine(cost);
        Console.ReadLine();
    }
}

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

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = new List<int>();
            int result = 0;
            for (int i = 0; i < 6; i++)
            {
                input.Add(Int32.Parse(Console.ReadLine()));
            }
            if (input[5] > input[4])
            {
                var secondType = new List<int>() { input[1], input[2], input[3] };
                int num = secondType[secondType.IndexOf(secondType.Min())];
                result += num * input[5];
                input[3] -= num;
                if (input[3] > 0)
                {
                    var firstType = new List<int>() { input[0], input[3] };
                    num = firstType[firstType.IndexOf(firstType.Min())];
                    result += num * input[4];
                }
            }
            else
            {
                var firstType = new List<int>() { input[0], input[3] };
                int num = firstType[firstType.IndexOf(firstType.Min())];
                result += num * input[4];
                input[3] -= num;
                if (input[3] > 0)
                {
                    var secondType = new List<int>() { input[1], input[2], input[3] };
                    num = secondType[secondType.IndexOf(secondType.Min())];
                    result += num * input[5];
                }
            }
            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication37
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());

            if (f >= e)
            {
                int min = Math.Min(b, Math.Min(c, d));

                long ans = min * f;
                if (d > min)
                {
                    d = d - min;

                    int minn = Math.Min(a, d);
                    ans = ans + minn * e;

                    Console.WriteLine(ans);
                }
                else
                    Console.WriteLine(ans);
            }
            else if (f < e)
            {
                int min = Math.Min(a, d);
                long ans = min * e;

                if (d == min)
                    Console.WriteLine(ans);
                else
                {
                    d = d - min;
                    ans = ans + Math.Min(b, Math.Min(c, d)) * f;
                    Console.WriteLine(ans);
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        struct symbol: IComparable
        {
            public char value;
            public int index;

            public int CompareTo(object obj)
            {
                symbol second = (symbol)obj;
                return this.value.CompareTo(second.value);
            }
        }
        static void Sort(List<symbol> a, int n)
        {
            for(int i = 0; i<n-1; i++)
            {
                for(int j = 0; j<n - 1 -i; j++)
                {
                    if(a[j].value > a[j+1].value)
                    {
                        symbol temp = a[j];
                        a[j] = a[j + 1];
                        a[j + 1] = temp;
                    }
                }
            }
        }
        static void Main(string[] args)
        {
            int a, b, c, d, e, f;
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            c = int.Parse(Console.ReadLine());
            d = int.Parse(Console.ReadLine());
            e = int.Parse(Console.ReadLine());
            f = int.Parse(Console.ReadLine());
            int res = 0;
            if(e>f)
            {
                res += Math.Min(a, d) * e;
                d -= Math.Min(a, d);
                res += Math.Min(b, Math.Min(c, d)) * f;
            }
            else
            {
                res += Math.Min(b, Math.Min(c, d)) * f;
                d -= Math.Min(b, Math.Min(c, d));
                res += Math.Min(a, d) * e;
            }
            Console.WriteLine(res);
        }
    }
}

/* Date: 17.12.2019  *  Time: 21:45 */
//
// CF 608 A
//
// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2
//
//

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

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

class Example
{
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2019\\Task\\07 Codeforces\\043\\A.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2019\\Task\\07 Codeforces\\043\\OUTPUT.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
/*
		int q;

# if ( ONLINE_JUDGE )
		q = int.Parse (Console.ReadLine ());
# else
		q = int.Parse (sr.ReadLine ());
		sw.WriteLine ("*** TEST = " + q);
# endif

		for ( int qqq=0; qqq < q; qqq++ )
		{
*/
			int a, b, c, d, e, f;

# if ( ONLINE_JUDGE )
			a = int.Parse (Console.ReadLine ());
			b = int.Parse (Console.ReadLine ());
			c = int.Parse (Console.ReadLine ());
			d = int.Parse (Console.ReadLine ());
			e = int.Parse (Console.ReadLine ());
			f = int.Parse (Console.ReadLine ());
# else
			a = int.Parse (sr.ReadLine ());
			b = int.Parse (sr.ReadLine ());
			c = int.Parse (sr.ReadLine ());
			d = int.Parse (sr.ReadLine ());
			e = int.Parse (sr.ReadLine ());
			f = int.Parse (sr.ReadLine ());
# endif

# if ( ! ONLINE_JUDGE )
			sw.WriteLine ("*** a = " + a);
			sw.WriteLine ("*** b = " + b);
			sw.WriteLine ("*** c = " + c);
			sw.WriteLine ("*** d = " + d);
			sw.WriteLine ("*** e = " + e);
			sw.WriteLine ("*** f = " + f);
# endif

			int k = 0;
			b = Math.Min (b, c);

			if ( e > f )
			{
				int x = Math.Min (a, d);
				k = x*e;
				if ( d > a )
					k += Math.Min (b, d-a)*f;
			}
			else
			{
				int x = Math.Min (b, d);
				k = x*f;
				if ( d > b )
					k += Math.Min (a, d-b)*e;
			}

# if ( ONLINE_JUDGE )
			Console.WriteLine (k);
# else
			sw.WriteLine (k);
# endif

//		}

# if ( ! ONLINE_JUDGE )
		sw.Close ();
# endif
	}
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Math;
using static Solve.Methods;
using static Solve.Input;
using static Solve.Output;
using pii = Solve.Pair<int, int>;
using pll = Solve.Pair<long, long>;
using pli = Solve.Pair<long, int>;
using pil = Solve.Pair<int, long>;
using pss = Solve.Pair<string, string>;
using psi = Solve.Pair<string, int>;
using lint = System.Collections.Generic.List<int>;
using llong = System.Collections.Generic.List<long>;
using lstr = System.Collections.Generic.List<string>;
using llint = System.Collections.Generic.List<System.Collections.Generic.List<int>>;
using llstr = System.Collections.Generic.List<System.Collections.Generic.List<long>>;
using lllong = System.Collections.Generic.List<System.Collections.Generic.List<string>>;
using lii = System.Collections.Generic.List<Solve.Pair<int, int>>;
using lll = System.Collections.Generic.List<Solve.Pair<long, long>>;
using lli = System.Collections.Generic.List<Solve.Pair<long, int>>;
using lil = System.Collections.Generic.List<Solve.Pair<int, long>>;
using ll = System.Int64;

namespace Solve
{
    public class Solver
    {
        public void Main()
        {
            int a, b, c, d, e, f;
            In(out a, out b, out c);
            In(out d, out e, out f);

            int type1_cnt, type2_cnt;
            long ans = 0;
            if (e < f)
            {
                type2_cnt = Min(b,c,d);
                d -= type2_cnt;
                type1_cnt = Min(a, d);
            }
            else
            {
                type1_cnt = Min(a, d);
                d -= type1_cnt;
                type2_cnt = Min(b, c, d);
            }

            cout = type1_cnt * e + type2_cnt * f;

        }

        // ReSharper disable UnusedMember.Local
        private const int MOD = (int) 1e9 + 7,
            INF = 1000000010;

        private const long LINF = 1000000000000000100;
    }

    // ライブラリ置き場ここから

    [DebuggerDisplay("Value = {" + nameof(_value) + "}")]
    public struct ModInt : IEquatable<ModInt>, IComparable<ModInt>
    {
        private long _value;

        public const int MOD = (int) 1e9 + 7;

        public static readonly ModInt Zero = new ModInt(0);

        public static readonly ModInt One = new ModInt(1);

        public ModInt(long value)
        {
            _value = value % MOD;
        }

        private ModInt(int value)
        {
            _value = value;
        }

        public int Value => (int) _value;

        public ModInt Invert => ModPow(this, MOD - 2);

        public static ModInt operator -(ModInt value)
        {
            value._value = MOD - value._value;
            return value;
        }

        public static ModInt operator +(ModInt left, ModInt right)
        {
            left._value += right._value;
            if (left._value >= MOD) left._value -= MOD;
            return left;
        }

        public static ModInt operator -(ModInt left, ModInt right)
        {
            left._value -= right._value;
            if (left._value < 0) left._value += MOD;
            return left;
        }

        public static ModInt operator *(ModInt left, ModInt right)
        {
            left._value = left._value * right._value % MOD;
            return left;
        }

        public static ModInt operator /(ModInt left, ModInt right) => left * right.Invert;

        public static ModInt operator ++(ModInt value)
        {
            if (value._value == MOD - 1) value._value = 0;
            else value._value++;
            return value;
        }

        public static ModInt operator --(ModInt value)
        {
            if (value._value == 0) value._value = MOD - 1;
            else value._value--;
            return value;
        }

        public static bool operator ==(ModInt left, ModInt right) => left.Equals(right);

        public static bool operator !=(ModInt left, ModInt right) => !left.Equals(right);

        public static implicit operator ModInt(int value) => new ModInt(value);

        public static implicit operator ModInt(long value) => new ModInt(value);

        public static ModInt ModPow(ModInt value, long exponent)
        {
            var r = new ModInt(1);
            for (; exponent > 0; value *= value, exponent >>= 1)
                if ((exponent & 1) == 1)
                    r *= value;
            return r;
        }

        public static ModInt ModFact(int value)
        {
            var r = new ModInt(1);
            for (var i = 2; i <= value; i++) r *= value;
            return r;
        }

        public bool Equals(ModInt other) => _value == other._value;

        public override bool Equals(object obj)
        {
            return obj != null && this.Equals((ModInt) obj);
        }

        public override int GetHashCode() => _value.GetHashCode();

        public override string ToString() => _value.ToString();

        public int CompareTo(ModInt other)
        {
            return _value.CompareTo(other._value);
        }
    }
    // ライブラリ置き場ここまで

    #region Templete

#if !LOCAL
namespace Library { }
#endif
    public static class Methods
    {
        public static readonly int[] dx = {-1, 0, 0, 1};
        public static readonly int[] dy = {0, 1, -1, 0};

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void Assert(bool b, string message = null)
        {
            if (!b) throw new Exception(message ?? "Assert failed.");
        }

        /*
        public static Comparison<T> greater<T>()
            where T : IComparable<T>
            => (a, b) => b.CompareTo(a);
        */

        public static string JoinSpace<T>(this IEnumerable<T> source) => source.Join(" ");
        public static string JoinEndline<T>(this IEnumerable<T> source) => source.Join("\n");
        public static string Join<T>(this IEnumerable<T> source, string s) => string.Join(s, source);
        public static string Join<T>(this IEnumerable<T> source, char c) => string.Join(c.ToString(), source);

        ///
        /// <see cref="Pair{T1, T2}"/> クラスのインスタンスを作成します。
        ///
        /// <typeparam name="T1">firstの型</typeparam>
        /// <typeparam name="T2">secondの型</typeparam>
        /// <param name="first">firstの値</param>
        /// <param name="second">secondの値</param>
        /// <returns>作成した<see cref="Pair{T1, T2}"/> クラスのインスタンス</returns>
        public static Pair<T1, T2> make_pair<T1, T2>(T1 first, T2 second)
            where T1 : IComparable<T1>
            where T2 : IComparable<T2>
            => new Pair<T1, T2>(first, second);

        /// aとbをスワップします。
        public static void Swap<T>(ref T a, ref T b) where T : struct
        {
            var tmp = b;
            b = a;
            a = tmp;
        }

        /// aとbの最大公約数を求めます。
        /// <returns>aとbの最大公約数</returns>
        public static long Gcd(long a, long b)
        {
            while (true)
            {
                if (a < b) Swap(ref a, ref b);
                if (a % b == 0) return b;
                var x = a;
                a = b;
                b = x % b;
            }
        }

        /// aとbの最小公倍数を求めます。
        /// <returns>aとbの最小公倍数</returns>
        public static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        ///
        /// 指定した数値が素数であるかを判定します。
        ///
        /// <remarks>計算量 (sqrt(value)) </remarks>
        /// <param name="value">判定する数値</param>
        /// <returns>value が素数であるか</returns>
        public static bool IsPrime(long value)
        {
            if (value <= 1) return false;
            for (long i = 2; i * i <= value; i++)
                if (value % i == 0)
                    return false;
            return true;
        }

        ///
        /// <see cref="a"/> ^ <see cref="b"/> (mod <see cref="p"/>) を求める
        ///
        /// <returns><see cref="a"/> ^ <see cref="b"/> (mod <see cref="p"/>) の値</returns>
        public static long PowMod(long a, long b, long p)
        {
            long res = 1;
            while (b > 0)
            {
                if (b % 2 != 0) res = res * a % p;
                a = a * a % p;
                b >>= 1;
            }

            return res;
        }

        ///
        /// mod pにおけるaの逆元を求めます。
        ///
        /// <param name="a"></param>
        /// <param name="p">法</param>
        /// <returns></returns>
        public static long ModInv(long a, long p)
            => PowMod(a, p - 2, p);

        public static int DivCeil(int left, int right)
            => left / right + (left % right == 0 ? 0 : 1);

        public static long DivCeil(long left, long right)
            => left / right + (left % right == 0L ? 0L : 1L);

        ///
        /// src の順列を求めます。
        ///
        /// <typeparam name="T">型</typeparam>
        /// <param name="src">順列を求める配列</param>
        /// <returns>src の順列</returns>
        public static IEnumerable<T[]> Permutations<T>(IEnumerable<T> src)
        {
            var ret = new List<T[]>();
            Search(ret, new Stack<T>(), src.ToArray());
            return ret;
        }

        private static void Search<T>(ICollection<T[]> perms, Stack<T> stack, T[] a)
        {
            int N = a.Length;
            if (N == 0) perms.Add(stack.Reverse().ToArray());
            else
            {
                var b = new T[N - 1];
                Array.Copy(a, 1, b, 0, N - 1);
                for (int i = 0; i < a.Length; ++i)
                {
                    stack.Push(a[i]);
                    Search(perms, stack, b);
                    if (i < b.Length) b[i] = a[i];
                    stack.Pop();
                }
            }
        }

        ///
        /// 指定した条件を満たす最小の数値を返します。
        ///
        /// <param name="low">検索する数値の最小値</param>
        /// <param name="high">検索する数値の最大値</param>
        /// <param name="expression">条件</param>
        /// <returns>条件を満たす最小の数値</returns>
        public static long BinarySearch(long low, long high, Func<long, bool> expression)
        {
            while (low < high)
            {
                long middle = (high - low) / 2 + low;
                if (!expression(middle))
                    high = middle;
                else
                    low = middle + 1;
            }

            return high;
        }

        ///
        /// 指定した値以上の先頭のインデクスを返します。
        ///
        /// <typeparam name="T">比較する値の型</typeparam>
        /// <param name="arr">対象の配列（※ソート済みであること）</param>
        /// <param name="start">開始インデクス [inclusive]</param>
        /// <param name="end">終了インデクス [exclusive]</param>
        /// <param name="value">検索する値</param>
        /// <param name="comparer">比較関数(インターフェイス)</param>
        /// <returns>指定した値以上の先頭のインデクス</returns>
        public static int LowerBound<T>(T[] arr, int start, int end, T value, IComparer<T> comparer)
        {
            int low = start;
            int high = end;
            while (low < high)
            {
                var mid = ((high - low) >> 1) + low;
                if (comparer.Compare(arr[mid], value) < 0)
                    low = mid + 1;
                else
                    high = mid;
            }

            return low;
        }

        ///
        /// 指定した値以上の先頭のインデクスを返します。
        ///
        /// <typeparam name="T">比較する値の型</typeparam>
        /// <param name="arr">対象の配列（※ソート済みであること）</param>
        /// <param name="value">検索する値</param>
        /// <returns>指定した値以上の先頭のインデクス</returns>
        public static int LowerBound<T>(T[] arr, T value) where T : IComparable
        {
            return LowerBound(arr, 0, arr.Length, value, Comparer<T>.Default);
        }

        ///
        /// 指定した値より大きい先頭のインデクスを返します。
        ///
        /// <typeparam name="T">比較する値の型</typeparam>
        /// <param name="arr">対象の配列（※ソート済みであること）</param>
        /// <param name="start">開始インデクス [inclusive]</param>
        /// <param name="end">終了インデクス [exclusive]</param>
        /// <param name="value">検索する値</param>
        /// <param name="comparer">比較関数(インターフェイス)</param>
        /// <returns>指定した値より大きい先頭のインデクス</returns>
        public static int UpperBound<T>(T[] arr, int start, int end, T value, IComparer<T> comparer)
        {
            int low = start;
            int high = end;
            while (low < high)
            {
                var mid = ((high - low) >> 1) + low;
                if (comparer.Compare(arr[mid], value) <= 0)
                    low = mid + 1;
                else
                    high = mid;
            }

            return low;
        }

        ///
        /// 指定した値より大きい先頭のインデクスを返します。
        /// Z
        /// <typeparam name="T">比較する値の型</typeparam>
        /// <param name="arr">対象の配列（※ソート済みであること）</param>
        /// <param name="value">検索する値</param>
        /// <returns>指定した値より大きい先頭のインデクス</returns>
        public static int UpperBound<T>(T[] arr, T value)
        {
            return UpperBound(arr, 0, arr.Length, value, Comparer<T>.Default);
        }

        public static IEnumerable<TResult> SelectNotNull<TSource, TResult>(this IEnumerable<TSource> source,
            Func<TSource, TResult> func)
            => source.Where(val => val != null).Select(func);

        public static IEnumerable<TSource> WhereNotNull<TSource>(this IEnumerable<TSource> source)
            => source.Where(val => val != null);

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static T[] ArrayOf<T>(params T[] arr) => arr;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static List<T> ListOf<T>(params T[] arr) => new List<T>(arr);

        public static IEnumerable<TResult> Repeat<TResult>(TResult value)
        {
            while (true) yield return value;
            // ReSharper disable once IteratorNeverReturns
        }

        public static IEnumerable<TResult> Repeat<TResult>(TResult value, int count)
            => Enumerable.Repeat(value, count);

        [SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
        public static IEnumerable<TResult> Repeat<TResult>(this IEnumerable<TResult> source, int count)
        {
            if (source == null) throw new ArgumentNullException(nameof(source));
            if (count < 0) throw new ArgumentOutOfRangeException(nameof(count));
            for (int i = 0; i < count; i++)
                foreach (var v in source)
                    yield return v;
        }

        [SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
        public static IEnumerable<TResult> Repeat<TResult>(this IEnumerable<TResult> source)
        {
            if (source == null) throw new ArgumentNullException(nameof(source));
            while (true)
                foreach (var v in source)
                    yield return v;
        }

        ///
        /// 文字の配列を文字列に変換します。
        ///
        /// <param name="source">文字の配列</param>
        /// <returns>変換した文字列</returns>
        public static string AsString(this IEnumerable<char> source) => new string(source.ToArray());

        ///
        /// <see cref="source"/> の累積和を返します。
        ///
        /// <returns><see cref="source"/> の累積和</returns>
        public static IEnumerable<long> CumSum(this IEnumerable<long> source)
        {
            long sum = 0;
            foreach (var item in source)
                yield return sum += item;
        }

        ///
        /// <see cref="source"/> の累積和を返します。
        ///
        /// <returns><see cref="source"/> の累積和</returns>
        public static IEnumerable<int> CumSum(this IEnumerable<int> source)
        {
            int sum = 0;
            foreach (var item in source)
                yield return sum += item;
        }

        ///
        /// <see cref="value"/>が l以上 r未満の範囲に含まれているかを返します。
        ///
        /// <typeparam name="T">要素の型</typeparam>
        /// <param name="value">判定する値</param>
        /// <param name="l">下限の値 (含まれる)</param>
        /// <param name="r">上限の値 (含まれない)</param>
        /// <returns><see cref="value"/> が指定した範囲に含まれているか</returns>
        public static bool IsIn<T>(this T value, T l, T r)
            where T : IComparable<T>
        {
            if (l.CompareTo(r) > 0) throw new ArgumentException();
            return l.CompareTo(value) <= 0 && value.CompareTo(r) < 0;
        }

        ///
        /// <see cref="start"/> 以上 <see cref="end"/> 未満の値を <see cref="step"/> ずつ増やした結果を列挙します。
        ///
        /// <param name="start">値の下限 (含まれる)</param>
        /// <param name="end">値の上限 (含まれない)</param>
        /// <param name="step">1要素ごとに増やす値</param>
        /// <returns>範囲の結果</returns>
        public static IEnumerable<int> Range(int start, int end, int step = 1)
        {
            for (var i = start; i < end; i += step) yield return i;
        }

        ///
        /// 0 以上 <see cref="end"/> 未満の値を 1 ずつ増やした結果を列挙します。
        ///
        /// <param name="end">値の上限 (含まれない)</param>
        /// <returns>範囲の結果</returns>
        public static IEnumerable<int> Range(int end) => Range(0, end);

        ///
        /// <see cref="start"/> 以上 <see cref="end"/> 未満の値を <see cref="step"/> ずつ増やした結果を逆順に列挙します。
        ///
        /// <param name="start">値の下限 (含まれる)</param>
        /// <param name="end">値の上限 (含まれない)</param>
        /// <param name="step">1要素ごとに増やす値</param>
        /// <returns>範囲の結果</returns>
        public static IEnumerable<int> RangeReverse(int start, int end, int step = 1)
        {
            for (var i = end - 1; i >= start; i -= step) yield return i;
        }

        ///
        /// 0 以上 <see cref="end"/> 未満の値を 1 ずつ増やした結果を逆順に列挙します。
        ///
        /// <param name="end">値の上限 (含まれない)</param>
        /// <returns>範囲の結果</returns>
        public static IEnumerable<int> RangeReverse(int end) => RangeReverse(0, end);

        ///
        /// 指定した配列をコピーして昇順ソートします。（非破壊的）
        ///
        /// <typeparam name="T">ソートする配列の型</typeparam>
        /// <param name="arr">ソートする配列</param>
        /// <returns>ソートされた配列</returns>
        public static T[] Sort<T>(this T[] arr)
        {
            var array = new T[arr.Length];
            arr.CopyTo(array, 0);
            Array.Sort(array);
            return array;
        }

        ///
        /// 指定した配列をコピーして降順ソートします。（非破壊的）
        ///
        /// <typeparam name="T">ソートする配列の型</typeparam>
        /// <param name="arr">ソートする配列</param>
        /// <returns>ソートされた配列</returns>
        public static T[] SortDescending<T>(this T[] arr)
        {
            var array = new T[arr.Length];
            arr.CopyTo(array, 0);
            Array.Sort(array);
            Array.Reverse(array);
            return array;
        }

        public static double Log2(double x) => Log(x, 2);

        public static bool chmin<T>(ref T a, T b) where T : IComparable<T>
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
                return true;
            }

            return false;
        }

        public static bool chmax<T>(ref T a, T b) where T : IComparable<T>
        {
            if (a.CompareTo(b) < 0)
            {
                a = b;
                return true;
            }

            return false;
        }

        public static T Min<T>(params T[] col) => col.Min();
        public static T Max<T>(params T[] col) => col.Max();

        ///
        /// 要素数 (a, b) の、defaultValue で満たされた配列を作成します。
        ///
        /// <typeparam name="T">配列の型</typeparam>
        /// <param name="a">1次元の要素数</param>
        /// <param name="b">2次元の要素数</param>
        /// <param name="defaultValue">デフォルト値</param>
        /// <returns>指定した条件で初期化された配列</returns>
        public static T[][] Array2D<T>(int a, int b, T defaultValue = default(T))
        {
            var ret = new T[a][];
            for (int i = 0; i < a; i++)
            {
                ret[i] = Enumerable.Repeat(defaultValue, b).ToArray();
            }

            return ret;
        }

//        public static vector<T> ToVector<T>(this IEnumerable<T> source) => new vector<T>(source);
    }

    public static class Input
    {
        private const char _separator = ' ';
        private static readonly Queue<string> _input = new Queue<string>();
        private static readonly StreamReader sr =
#if FILE
            new StreamReader("in.txt");
#else
            new StreamReader(Console.OpenStandardInput());
#endif

        public static string ReadLine => sr.ReadLine();
        public static string ReadStr => Read;

        public static string Read
        {
            get
            {
                if (_input.Count != 0) return _input.Dequeue();

                // ReSharper disable once PossibleNullReferenceException
                var tmp = sr.ReadLine().Split(_separator);
                foreach (var val in tmp)
                {
                    _input.Enqueue(val);
                }

                return _input.Dequeue();
            }
        }

        public static int ReadInt => int.Parse(Read);
        public static long ReadLong => long.Parse(Read);
        public static double ReadDouble => double.Parse(Read);
        public static string[] StrArray() => ReadLine.Split(' ');
        public static int[] IntArray() => ReadLine.Split(' ').Select(int.Parse).ToArray();
        public static long[] LongArray() => ReadLine.Split(' ').Select(long.Parse).ToArray();

        public static string[] StrArray(int n)
        {
            var ret = new string[n];
            for (long i = 0; i < n; ++i) ret[i] = Read;
            return ret;
        }

        public static int[] IntArray(int n, int offset = 0, bool sorted = false)
        {
            var ret = StrArray(n).Select(x => int.Parse(x) + offset).ToArray();
            if (sorted) Array.Sort(ret);
            return ret;
        }

        public static long[] LongArray(int n, long offset = 0, bool sorted = false)
        {
            var ret = StrArray(n).Select(x => long.Parse(x) + offset).ToArray();
            if (sorted) Array.Sort(ret);
            return ret;
        }

        public static string[][] Str2DArray(int n, int m)
            => Enumerable.Repeat((string[]) null, n).Select(_ => StrArray(m)).ToArray();

        public static int[][] Int2DArray(int n, int m, int offset = 0)
            => Enumerable.Repeat((int[]) null, n).Select(_ => IntArray(m, offset)).ToArray();

        public static long[][] Long2DArray(int n, int m, long offset = 0)
            => Enumerable.Repeat((long[]) null, n).Select(_ => LongArray(m, offset)).ToArray();

        public static Tuple<string[], string[]> StrArrays2(int n)
        {
            var ret1 = new string[n];
            var ret2 = new string[n];
            for (int i = 0; i < n; i++)
            {
                ret1[i] = ReadStr;
                ret2[i] = ReadStr;
            }

            return Tuple.Create(ret1, ret2);
        }

        public static Tuple<int[], int[]> IntArrays2(int n, int offset1 = 0, int offset2 = 0)
        {
            var ret1 = new int[n];
            var ret2 = new int[n];
            for (int i = 0; i < n; i++)
            {
                ret1[i] = ReadInt + offset1;
                ret2[i] = ReadInt + offset2;
            }

            return Tuple.Create(ret1, ret2);
        }

        public static Tuple<long[], long[]> LongArrays2(int n, long offset1 = 0, long offset2 = 0)
        {
            var ret1 = new long[n];
            var ret2 = new long[n];
            for (int i = 0; i < n; i++)
            {
                ret1[i] = ReadLong + offset1;
                ret2[i] = ReadLong + offset2;
            }

            return Tuple.Create(ret1, ret2);
        }

        public static Tuple<string[], string[], string[]> StrArrays3(int n)
        {
            var ret1 = new string[n];
            var ret2 = new string[n];
            var ret3 = new string[n];
            for (int i = 0; i < n; i++)
            {
                ret1[i] = ReadStr;
                ret2[i] = ReadStr;
            }

            return Tuple.Create(ret1, ret2, ret3);
        }

        public static Tuple<int[], int[], int[]> IntArrays3(int n, int offset1 = 0, int offset2 = 0, int offset3 = 0)
        {
            var ret1 = new int[n];
            var ret2 = new int[n];
            var ret3 = new int[n];
            for (int i = 0; i < n; i++)
            {
                ret1[i] = ReadInt + offset1;
                ret2[i] = ReadInt + offset2;
                ret3[i] = ReadInt + offset3;
            }

            return Tuple.Create(ret1, ret2, ret3);
        }

        public static Tuple<long[], long[], long[]> LongArrays3(int n, long offset1 = 0, long offset2 = 0,
            long offset3 = 0)
        {
            var ret1 = new long[n];
            var ret2 = new long[n];
            var ret3 = new long[n];
            for (int i = 0; i < n; i++)
            {
                ret1[i] = ReadLong + offset1;
                ret2[i] = ReadLong + offset2;
                ret3[i] = ReadLong + offset3;
            }

            return Tuple.Create(ret1, ret2, ret3);
        }

        private static bool TypeEquals<T, U>() => typeof(T) == typeof(U);
        private static T ChangeType<T, U>(U a) => (T) System.Convert.ChangeType(a, typeof(T));

        private static T Convert<T>(string s) => TypeEquals<T, int>() ? ChangeType<T, int>(int.Parse(s))
            : TypeEquals<T, long>() ? ChangeType<T, long>(long.Parse(s))
            : TypeEquals<T, double>() ? ChangeType<T, double>(double.Parse(s))
            : TypeEquals<T, char>() ? ChangeType<T, char>(s[0])
            : ChangeType<T, string>(s);

        public static bool In<T>(out T a)
        {
            try
            {
                a = Convert<T>(Read);
                return true;
            }
            catch
            {
                a = default(T);
                return false;
            }
        }

        public static bool In<T, U>(out T a, out U b)
        {
            try
            {
                var ar = StrArray(2);
                a = Convert<T>(ar[0]);
                b = Convert(ar[1]);
                return true;
            }
            catch
            {
                a = default(T);
                b = default(U);
                return false;
            }
        }

        public static bool In<T, U, V>(out T a, out U b, out V c)
        {
            try
            {
                var ar = StrArray(3);
                a = Convert<T>(ar[0]);
                b = Convert(ar[1]);
                c = Convert<V>(ar[2]);
                return true;
            }
            catch
            {
                a = default(T);
                b = default(U);
                c = default(V);
                return false;
            }
        }

        public static bool In<T, U, V, W>(out T a, out U b, out V c, out W d)
        {
            try
            {
                var ar = StrArray(4);
                a = Convert<T>(ar[0]);
                b = Convert(ar[1]);
                c = Convert<V>(ar[2]);
                d = Convert<W>(ar[3]);
                return true;
            }
            catch
            {
                a = default(T);
                b = default(U);
                c = default(V);
                d = default(W);
                return false;
            }
        }

        public static bool In<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e)
        {
            try
            {
                var ar = StrArray(5);
                a = Convert<T>(ar[0]);
                b = Convert(ar[1]);
                c = Convert<V>(ar[2]);
                d = Convert<W>(ar[3]);
                e = Convert<X>(ar[4]);
                return true;
            }
            catch
            {
                a = default(T);
                b = default(U);
                c = default(V);
                d = default(W);
                e = default(X);
                return false;
            }
        }
    }

    public static class Output
    {
        public static void print<T>(T t) => Console.WriteLine(t);
        public static void print(params object[] o) => Console.WriteLine(o.Join(" "));

        public static void PrintBool(bool val, string yes = "Yes", string no = "No")
            => Console.WriteLine(val ? yes : no);

        public static void PrintYn(bool val) => PrintBool(val);
        public static void PrintYN(bool val) => PrintBool(val, "YES", "NO");
        public static void PrintPossible(bool val) => PrintBool(val, "Possible", "Impossible");
        public static void PrintYay(bool val) => PrintBool(val, "Yay!", ":(");

        public static void PrintDebug(params object[] args)
            => Console.Error.WriteLine(string.Join(" ", args));

        ///
        /// setter で設定された値を標準出力に出力します。
        ///
        public static object cout
        {
            set { Console.WriteLine(value); }
        }

        ///
        /// Local環境のみ，setter で設定された値を標準出力に出力します。
        ///
        public static object dout
        {
            set
            {
#if LOCAL
                Console.WriteLine(value);
#endif
            }
        }

        ///
        /// setter で設定された値を標準エラー出力に出力します。
        ///
        public static object cerr
        {
            set { Console.Error.WriteLine(value); }
        }

        public const string endl = "\n";
    }

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

            Console.Out.Flush();
            Console.Read();
        }
    }

    [DebuggerDisplay("({first}, {second})")]
    public class Pair<T1, T2> : IComparable<Pair<T1, T2>>, IEquatable<Pair<T1, T2>>
        where T1 : IComparable<T1>
        where T2 : IComparable<T2>
    {
        public Pair(T1 first, T2 second)
        {
            this.first = first;
            this.second = second;
        }

        public T1 first;
        public T2 second;

        public int CompareTo(Pair<T1, T2> other)
        {
            if (ReferenceEquals(this, other)) return 0;
            if (ReferenceEquals(null, other)) return 1;
            var firstComparison = first.CompareTo(other.first);
            return firstComparison != 0 ? firstComparison : second.CompareTo(other.second);
        }

        public override string ToString() => $"({first}, {second})";

        public bool Equals(Pair<T1, T2> other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return EqualityComparer<T1>.Default.Equals(first, other.first) &&
                   EqualityComparer<T2>.Default.Equals(second, other.second);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            return obj.GetType() == GetType() && Equals((Pair<T1, T2>) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (EqualityComparer<T1>.Default.GetHashCode(first) * 397) ^
                       EqualityComparer<T2>.Default.GetHashCode(second);
            }
        }
    }

    #endregion
}

using System;
using System.Collections.Generic;
class Solution
{
    static bool[] is_prime;
    private static void MakeSieve(int max)
    {
        // Make an array indicating whether numbers are prime.
        is_prime = new bool[max + 1];
        for (int i = 2; i <= max; i++) is_prime[i] = true;

        // Cross out multiples.
        for (int i = 2; i <= max; i++)
        {
            // See if i is prime.
            if (is_prime[i])
            {
                // Knock out multiples of i.
                for (int j = i * 2; j <= max; j += i)
                    is_prime[j] = false;
            }
        }
    }
    public static string ToHexspeak(string num)
    {
        long number = long.Parse(num);
        string hexString = number.ToString("X");
        hexString = hexString.Replace('0', 'O').Replace('1', 'I');
        bool valid = true;
        for (int i = 0; i < hexString.Length; i++)
        {
            if (hexString[i] > '1' && hexString[i] <= '9')
            {
                valid = false;
                break;
            }
        }
        if (valid)
            return hexString;
        else
            return "ERROR";
    }
    public static IList<IList<int>> RemoveInterval(int[][] intervals, int[] toBeRemoved)
    {
        IList<IList<int>> returnedIntervals = new List<IList<int>>();
        if (toBeRemoved[0] <= intervals[0][0])
        {
            if (toBeRemoved[1] >= intervals[intervals.Length - 1][1])
                return returnedIntervals;
            for (int i = 0; i < intervals.Length; i++)
            {
                if (toBeRemoved[1] <= intervals[i][1])
                {
                    List<int> injectedInterval = new List<int>();
                    injectedInterval.Add(toBeRemoved[1]);
                    injectedInterval.Add(intervals[i][1]);
                    returnedIntervals.Add(injectedInterval);
                    for (int j = i + 1; j < intervals.Length; j++)
                    {
                        injectedInterval = new List<int>();
                        injectedInterval.Add(intervals[j][0]); injectedInterval.Add(intervals[j][1]);
                        returnedIntervals.Add(injectedInterval);
                    }
                    return returnedIntervals;
                }
            }
        }
        else if (toBeRemoved[1] >= intervals[intervals.Length - 1][1])
        {
            for (int i = 0; i < intervals.Length; i++)
            {
                List<int> injectedInterval = new List<int>();
                if (toBeRemoved[0] >= intervals[i][0] && toBeRemoved[0] <= intervals[i][1])
                {
                    injectedInterval.Add(intervals[i][0]);
                    injectedInterval.Add(toBeRemoved[0]);
                    returnedIntervals.Add(injectedInterval);
                    return returnedIntervals;
                }
                injectedInterval = new List<int>();
                injectedInterval.Add(intervals[i][0]); injectedInterval.Add(intervals[i][1]);
                returnedIntervals.Add(injectedInterval);
            }
        }
        else
        {
            for (int i = 0; i < intervals.Length; i++)
            {
                List<int> injectedInterval = new List<int>();
                if (toBeRemoved[0] > intervals[i][1] || toBeRemoved[1] < intervals[i][0])
                {
                    injectedInterval = new List<int>();
                    injectedInterval.Add(intervals[i][0]); injectedInterval.Add(intervals[i][1]);
                    returnedIntervals.Add(injectedInterval);
                }
                else if (toBeRemoved[0] >= intervals[i][0] && toBeRemoved[0] <= intervals[i][1])
                {
                    injectedInterval = new List<int>();
                    injectedInterval.Add(intervals[i][0]);
                    injectedInterval.Add(toBeRemoved[0]);
                    returnedIntervals.Add(injectedInterval);
                    if (toBeRemoved[1] < intervals[i][1])
                    {
                        injectedInterval = new List<int>();
                        injectedInterval.Add(toBeRemoved[1]);
                        injectedInterval.Add(intervals[i][1]);
                        returnedIntervals.Add(injectedInterval);

                    }
                }
                else if (toBeRemoved[1] >= intervals[i][0] && toBeRemoved[1] <= intervals[i][1])
                {
                    injectedInterval = new List<int>();
                    injectedInterval.Add(toBeRemoved[1]);
                    injectedInterval.Add(intervals[i][1]);
                    returnedIntervals.Add(injectedInterval);
                }
            }
        }
        return returnedIntervals;
    }
    public class treeNodeWithValue
    {
        public int value;
        public List<treeNodeWithValue> childern;
        public int NodeNumber;
        public int childsCount;
        public treeNodeWithValue(int val, int nodeVal)
        {
            value = val;
            NodeNumber = nodeVal;
            childern = new List<treeNodeWithValue>();
            childsCount = 0;
        }
    }
    public class treeWithValues
    {
        public treeNodeWithValue root;
        public void createTree(int[] arrNodesParents, int[] arrValues)
        {
            root = new treeNodeWithValue(arrValues[0], 0);
            for (int i = 1; i < arrNodesParents.Length; i++)
            {
                treeNodeWithValue temp = new treeNodeWithValue(arrValues[i], i);
                traverseTheTree(root, temp, arrNodesParents[i]);
            }
        }
        public void traverseTheTree(treeNodeWithValue rooted, treeNodeWithValue newNode, int parentNumber)
        {
            if (rooted.NodeNumber == parentNumber)
            {
                rooted.childern.Add(newNode);
            }
            else if (rooted.childern.Count > 0)
            {
                for (int i = 0; i < rooted.childern.Count; i++)
                {
                    traverseTheTree(rooted.childern[i], newNode, parentNumber);
                }
            }
        }
        public int deleteCountZeroPaths(treeNodeWithValue rooted)
        {
            if (rooted.childern.Count > 0)
            {
                for (int i = 0; i < rooted.childern.Count; i++)
                {
                    int tempCount = deleteCountZeroPaths(rooted.childern[i]);
                    if (tempCount == 0)
                    {
                        rooted.childern.RemoveAt(i);
                    }
                    else
                        rooted.childsCount += tempCount;
                }
            }
            else
            {
                return rooted.value;
            }
            int temp = rooted.value + rooted.childsCount;
            return temp;
        }
        public int countThetree(treeNodeWithValue rooted)
        {
            int tempCount = 1;
            if (rooted.childern.Count > 0)
            {
                for (int i = 0; i < rooted.childern.Count; i++)
                {
                    tempCount += countThetree(rooted.childern[i]);
                }
            }
            return tempCount;
        }

    }
    public static int DeleteTreeNodes(int nodes, int[] parent, int[] value)
    {
        treeWithValues tree = new treeWithValues();
        tree.createTree(parent, value);
        tree.deleteCountZeroPaths(tree.root);
        return tree.countThetree(tree.root);
        //return 0;
    }
    //static void Main(string[] args)
    //{
    //    int testcases = int.Parse(Console.ReadLine());
    //    for (int t = 0; t < testcases; t++)
    //    {
    //        string[] words = Console.ReadLine().Split(' ');
    //        string a = words[0];
    //        string b = words[1];
    //        string result = "";
    //        char minC = 'Z';
    //        int minIndexI = -1;
    //        int minIndexJ = -1;
    //        for (int i = 0; i < a.Length - 1; i++)
    //        {
    //            bool found = false;
    //            for (int j = i + 1; j < a.Length; j++)
    //            {
    //                if (a[i] > a[j] && a[j] < minC)
    //                {
    //                    minIndexI = i;
    //                    minIndexJ = j;
    //                    minC = a[j];
    //                    found = true;
    //                }
    //            }
    //            if (found)
    //                break;
    //        }
    //        if (minIndexI > -1)
    //        {
    //            for (int i = 0; i < a.Length; i++)
    //            {
    //                if (minIndexI == i)
    //                {
    //                    result += a[minIndexJ];
    //                }
    //                else if (minIndexJ == i)
    //                {
    //                    result += a[minIndexI];
    //                }
    //                else
    //                    result += a[i];
    //            }
    //            a = result;
    //        }
    //        if (a.Length > b.Length)
    //        {
    //            bool canBeDone = false;
    //            for (int i = 0; i < b.Length; i++)
    //            {
    //                if (a[i] < b[i])
    //                {
    //                    canBeDone = true;
    //                    break;
    //                }
    //                else if (a[i] > b[i])
    //                {
    //                    break;
    //                }
    //            }
    //            if (canBeDone)
    //                Console.WriteLine(a);
    //            else
    //                Console.WriteLine("---");
    //        }
    //        else if (a.Length < b.Length)
    //        {
    //            bool canBeDone = false;
    //            bool aGreater = false;
    //            for (int i = 0; i < a.Length; i++)
    //            {
    //                if (a[i] < b[i])
    //                {
    //                    canBeDone = true;
    //                    break;
    //                }
    //                else if (a[i] > b[i])
    //                {
    //                    aGreater = true;
    //                    break;
    //                }
    //            }
    //            if (canBeDone || aGreater == false)
    //                Console.WriteLine(a);
    //            else
    //                Console.WriteLine("---");
    //        }
    //        else {
    //            bool canBeDone = false;
    //            for (int i = 0; i < a.Length; i++)
    //            {
    //                if (a[i] < b[i])
    //                {
    //                    canBeDone = true;
    //                    break;
    //                }
    //                else if (a[i] > b[i])
    //                {
    //                    break;
    //                }
    //            }
    //            if (canBeDone)
    //                Console.WriteLine(a);
    //            else
    //                Console.WriteLine("---");
    //        }
    //    }
    //}
    static void Main(string[] args)
    {
        int t, s, v, j, c1, c2;
        t = int.Parse(Console.ReadLine());
        s = int.Parse(Console.ReadLine());
        v = int.Parse(Console.ReadLine());
        j = int.Parse(Console.ReadLine());
        c1 = int.Parse(Console.ReadLine());
        c2 = int.Parse(Console.ReadLine());
        int cost = 0;
        if (c1 > c2)
        {
            int min = Math.Min(j, t);
            j -= min;
            cost += (c1 * min);
            if (j > 0)
            {
                int cost2 = Math.Min(j, Math.Min(v, s));
                cost += (cost2 * c2);
            }
        }
        else
        {
            int cost2 = Math.Min(j, Math.Min(v, s));
            cost += (cost2 * c2);
            j = j - cost2;
            if (j > 0)
            {
                int min = Math.Min(j, t);
                cost += (c1 * min);
            }
        }
        Console.WriteLine(cost);
    }
}

using System;
using System.Linq;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = int.Parse(Console.ReadLine());
            var d = int.Parse(Console.ReadLine());
            var e = int.Parse(Console.ReadLine());
            var f = int.Parse(Console.ReadLine());
            var max = 0;
            var minFirs = Math.Min(a, d);
            var minSec = Math.Min(d, Math.Min(b, c));

            if (f > e)
            {
                max += (minSec * f);
                var v = d - minSec;
                max += Math.Min(minFirs, v) * e;
            }
            else
            {
                max += minFirs * e;
                var v = d - minFirs;
                max += Math.Min(minSec, v) * f;
            }

            Console.WriteLine(max);
            //Console.ReadKey();

            //var t = int.Parse(Console.ReadLine());
            //var res = new List<string>();
            //for (int i = 0; i < t; i++)
            //{
            //    var inputs = Console.ReadLine().Split(' ');
            //    var r = int.Parse(inputs[0]);
            //    var g = int.Parse(inputs[1]);
            //    var b = int.Parse(inputs[2]);
            //    var sum = r + g + b;
            //    var max = Math.Max(r, Math.Max(g, b));
            //    if (max > sum - max)
            //        res.Add("NO");
            //    else
            //    {
            //        res.Add("YES");
            //    }
            //}

            //res.ForEach(x => Console.WriteLine(x));

            //var client = new SmppClient();
            //client.Connect("172.30.157.206", int.Parse("3855"));
            //client.SystemType = "sms";
            //client.SendSpeedLimit = 30;
            //client.Bind("smpp3855", "pkt7HPav");

            //var ls = new List<string>();
            //for (int i = 0; i < 30; i++)
            //    ls.Add("axalisatestos gamogzava SMS NO: 90911, Code:123");
            //var sent = 0; int thr = 0;

            //var st = new Stopwatch();
            //st.Start();

            //Parallel.ForEach(ls, sms =>
            //{
            //    var coding = Inetlab.SMPP.Common.DataCodings.Default;
            //    if (ContainsUnicodeCharacter(sms))
            //    {
            //        coding = Inetlab.SMPP.Common.DataCodings.UCS2;
            //    }

            //    var submitResp = client.Submit(
            //                           SMS.ForSubmit()
            //                               .From("test")
            //                               .To("557964515")
            //                               .Coding(coding)
            //                               .Text(sms));
            //    if (submitResp.All(x => x.Status == Inetlab.SMPP.Common.CommandStatus.ESME_ROK))
            //    {
            //        sent++;
            //    }
            //    else if (submitResp.All(x => x.Status == Inetlab.SMPP.Common.CommandStatus.ESME_RTHROTTLED))
            //    {
            //        thr++;
            //    }
            //});
            //st.Stop();
            //Console.WriteLine(st.ElapsedMilliseconds);

        }

        //public static bool ContainsUnicodeCharacter(string input)
        //{
        //    const int MaxAnsiCode = 255;

        //    return input.Any(c => c > MaxAnsiCode);
        //}
    }
}

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
namespace Contest
{

	class Program
    {
        public static void Main()
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());
            int h = Math.Min(b, Math.Min(c,d));
            int k = Math.Min(a, d - h);
            int max = e * k + f * h;
            k = Math.Min(a, d);
            h = Math.Min(b, Math.Min(c, d - k));
            max = Math.Max(max, e * k + f * h);
            Console.WriteLine(max);

        }
    }
}

using System;

public class Program
{
	public static void Main()
	{
		var a  = int.Parse(Console.ReadLine());
		var b  = int.Parse(Console.ReadLine());
		var c  = int.Parse(Console.ReadLine());
		var d  = int.Parse(Console.ReadLine());
		var e  = int.Parse(Console.ReadLine());
		var f  = int.Parse(Console.ReadLine());

		var firstType = e > f;

		var maxPrice = 0;

		if(firstType){
			var maxFirstType = Math.Min(d,a);
			maxPrice = maxFirstType * e;
			d -= maxFirstType;
			var maxSecondType = Math.Min(b, Math.Min(c,d));
			maxPrice += maxSecondType * f;
		}else{
			var maxSecondType = Math.Min(b, Math.Min(c,d));
			maxPrice += maxSecondType * f;
			d -= maxSecondType;
			var maxFirstType = Math.Min(d,a);
			maxPrice += maxFirstType * e;
		}

		Console.WriteLine(maxPrice);
	}
}

// Problem: 1271A - Suits
// Author: Gusztav Szmolik

using System;

class Suits
    {
    static int Main ()
        {
        string line = Console.ReadLine ();
        if (line == null)
            return -1;
        char[] delims = {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        uint a;
        if (!UInt32.TryParse (words[0], out a))
            return -1;
        if (a < 1 || a > 100000)
            return -1;
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        uint b;
        if (!UInt32.TryParse (words[0], out b))
            return -1;
        if (b < 1 || b > 100000)
            return -1;
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        uint c;
        if (!UInt32.TryParse (words[0], out c))
            return -1;
        if (c < 1 || c > 100000)
            return -1;
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        uint d;
        if (!UInt32.TryParse (words[0], out d))
            return -1;
        if (d < 1 || d > 100000)
            return -1;
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        ushort e;
        if (!UInt16.TryParse (words[0], out e))
            return -1;
        if (e < 1 || e > 1000)
            return -1;
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        ushort f;
        if (!UInt16.TryParse (words[0], out f))
            return -1;
        if (f < 1 || f > 1000)
            return -1;
        uint numSuitTyp1 = 0;
        uint numSuitTyp2 = 0;
        if (e > f)
            {
            numSuitTyp1 = Math.Min (a,d);
            numSuitTyp2 = Math.Min (Math.Min (d-numSuitTyp1,b), c);
            }
        else
            {
            numSuitTyp2 = Math.Min (Math.Min (d,b), c);
            numSuitTyp1 = Math.Min (d-numSuitTyp2,a);
            }
        uint ans = numSuitTyp1*e+numSuitTyp2*f;
        Console.WriteLine (ans);
        return 0;
        }
    }

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class CODEFORCES2
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var ary = NNList(6);
            var ans = 0L;
            for (var i = 0; i <= ary[3]; i++)
            {
                ans = Max(ans, Min(ary[0], i) * ary[4] + Min(Min(ary[1], ary[2]), ary[3] - i) * ary[5]);
            }
            Console.WriteLine(ans);
        }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static public void Main(string[] args) { if (args.Length == 0) { Console.SetOut(new Printer(Console.OpenStandardOutput())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
    }
}
namespace Library {
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using static Codeforces.IO;
using static System.Linq.Enumerable;

namespace Codeforces
{
    static class IO
    {
        static StringBuilder builder = new StringBuilder();
        static Dummy dummy = new Dummy();
        class Dummy
        {
            ~Dummy()
            {
                Console.Write(builder);
            }
        }
        public static void Write(object obj)
        {
            builder.Append(obj);
        }
        public static void WriteLine(object obj)
        {
            builder.AppendLine(obj.ToString());
        }
        public static void Write(params object[] objs)
        {
            if (objs.Length != 0)
            {
                Write(objs[0]);
                for (var i = 1; i < objs.Length; ++i)
                {
                    Write(" ");
                    Write(objs[i]);
                }
            }
        }
        public static void WriteLine(params object[] objs)
        {
            Write(objs);
            WriteLine();
        }

        public static void WriteLine()
        {
            builder.AppendLine();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }
        public static T ReadLine<T>(Func<string, T> parser)
        {
            return parser(ReadLine());
        }
        public static T[] ReadArray<T>(Func<string, T> parser)
        {
            return ReadLine().Split(' ').Select(parser).ToArray();
        }
        public static string[] ReadArray()
        {
            return ReadLine().Split(' ');
        }
        public static (T, T) ReadTuple2<T>(Func<string, T> parser)
        {
            var ar = ReadArray(parser);
            return (ar[0], ar[1]);
        }
        public static (string, string) ReadTuple2()
        {
            var ar = ReadArray();
            return (ar[0], ar[1]);
        }
        public static (T, T, T) ReadTuple3<T>(Func<string, T> parser)
        {
            var ar = ReadArray(parser);
            return (ar[0], ar[1], ar[2]);
        }
        public static (string, string, string) ReadTuple3()
        {
            var ar = ReadArray();
            return (ar[0], ar[1], ar[2]);
        }
    }

    static class Program
    {
        static void Main(string[] args)
        {
            var x = ReadLine(int.Parse);
            var b = ReadLine(int.Parse);
            var c = ReadLine(int.Parse);
            var d = ReadLine(int.Parse);
            var first = ReadLine(int.Parse);
            var second = ReadLine(int.Parse);
            var y = Math.Min(b, c);
            var max = 0;
            for(var i = 0; i <= Math.Min(x, d); ++i)
            {
                max = Math.Max(max, i * first + Math.Min(d - i, y) * second);
            }
            WriteLine(max);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace suits
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d, e, f;

            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());
            c = Convert.ToInt32(Console.ReadLine());
            d = Convert.ToInt32(Console.ReadLine());
            e = Convert.ToInt32(Console.ReadLine());
            f = Convert.ToInt32(Console.ReadLine());

            int m = min(b, c, d);

            int all = m * f + maradek(d - m) * e;

            Console.WriteLine(all);
            Console.ReadLine();
        }

        public static int min(int a, int b, int c)
        {
            return Math.Min(Math.Min(a, b), c);
        }
        public static int maradek(int x)
        {
            if (x > 0)
            {
                return x;
            }
            return 0;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class A1271_Suits
    {
        public static void Main()
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());
            int f = int.Parse(Console.ReadLine());

            int[] array = new int[3];
            decimal totalSuit1 = 0;
            decimal totalSuit2 = 0;

            if (e > f)
            {
                if (a > d)
                {
                    totalSuit1 = d * e;
                    a -= d;
                }
                else
                {
                    totalSuit1 = a * e;
                    d -= a;
                }
                array[0] = b;
                array[1] = c;
                array[2] = d;
                Array.Sort(array);
                totalSuit2 = f * array[0];
            }
            else {
                array[0] = b;
                array[1] = c;
                array[2] = d;
                Array.Sort(array);
                totalSuit2 = f * array[0];

                d -= array[0];

                if (a > d)
                {
                    totalSuit1 = d * e;
                    a -= d;
                }
                else
                {
                    totalSuit1 = a * e;
                    d -= a;
                }
            }

                Console.WriteLine(totalSuit2+totalSuit1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication37
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());

            int min = Math.Min(b, Math.Min(c,d));
            int max = Math.Max(e, f);

            int ans = min * max;
            if (d > min)
            {
                d = d - min;

                int minn = Math.Min(a, d);
                ans = ans + minn * Math.Min(e, f);

                Console.WriteLine(ans);
            }
            else
                Console.WriteLine(ans);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication37
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());

            if (f > e)
            {
                int min = Math.Min(b, Math.Min(c, d));

                int ans = min * f;
                if (d > min)
                {
                    d = d - min;

                    int minn = Math.Min(a, d);
                    ans = ans + minn * e;

                    Console.WriteLine(ans);
                }
                else
                    Console.WriteLine(ans);
            }
            else if (f <= e)
            {
                int min = Math.Min(a, d);
                int ans = min * e;

                if (d == min)
                    Console.WriteLine(ans);
                else
                {
                    d = d - min;
                    ans = Math.Min(b, Math.Min(c, d)) * f;
                    Console.WriteLine(ans);
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication37
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());

            if (f >= e)
            {
                int min = Math.Min(b, Math.Min(c, d));

                int ans = min * f;
                if (d > min)
                {
                    d = d - min;

                    int minn = Math.Min(a, d);
                    ans = ans + minn * e;

                    Console.WriteLine(ans);
                }
                else
                    Console.WriteLine(ans);
            }
            else if (f < e)
            {
                int min = Math.Min(a, d);
                int ans = min * e;

                if (d == min)
                    Console.WriteLine(ans);
                else
                {
                    d = d - min;
                    ans = Math.Min(b, Math.Min(c, d)) * f;
                    Console.WriteLine(ans);
                }
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication37
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int d = Convert.ToInt32(Console.ReadLine());
            int e = Convert.ToInt32(Console.ReadLine());
            int f = Convert.ToInt32(Console.ReadLine());

            if (f >= e)
            {
                int min = Math.Min(b, Math.Min(c, d));

                long ans = min * f;
                if (d > min)
                {
                    d = d - min;

                    int minn = Math.Min(a, d);
                    ans = ans + minn * e;

                    Console.WriteLine(ans);
                }
                else
                    Console.WriteLine(ans);
            }
            else if (f < e)
            {
                int min = Math.Min(a, d);
                long ans = min * e;

                if (d == min)
                    Console.WriteLine(ans);
                else
                {
                    d = d - min;
                    ans = Math.Min(b, Math.Min(c, d)) * f;
                    Console.WriteLine(ans);
                }
            }
        }
    }
}