a,b,c,x,y = map(int,input().split())
minprice = 10 ** 12
if x < y:
         for i in range(x+1):
                  if ((a * x + b * y) - (a + b - 2 * c)*i) < minprice:
                           minprice = ((a * x + b * y) - (a + b - 2 * c)*i)
else:
         for j in range(y+1):
                  if ((a * x + b * y) - (a + b - 2 * c)*j) < minprice:
                           minprice = ((a * x + b * y) - (a + b - 2 * c)*j)
print(minprice)
