A, B, C, X, Y = list(map(int, input().split()))



print((min(A*X+B*Y, min(X, Y)*C*2 + (X-min(X, Y))*A+(Y-min(X, Y))*B, max(X, Y)*C*2)))
A, B, C, X, Y = list(map(int, input().split()))



cost_1 = A*X + B*Y

cost_2 = C * max(X, Y) * 2



cost_3 = C * min(X, Y) * 2 + (X - min(X, Y))*A + (Y - min(X, Y))*B





print((min(cost_1, cost_2, cost_3)))
A, B, C, X, Y = list(map(int, input().split()))
print(
    (
        min(
            A * X + B * Y,
            min(X, Y) * C * 2 + (X - min(X, Y)) * A + (Y - min(X, Y)) * B,
            max(X, Y) * C * 2,
        )
    )
)

A, B, C, X, Y = list(map(int, input().split()))
cost_1 = A * X + B * Y
cost_2 = C * max(X, Y) * 2
cost_3 = C * min(X, Y) * 2 + (X - min(X, Y)) * A + (Y - min(X, Y)) * B
print((min(cost_1, cost_2, cost_3)))

-print( -    ( -        min( -            A * X + B * Y, -            min(X, Y) * C * 2 + (X - min(X, Y)) * A + (Y - min(X, Y)) * B, -            max(X, Y) * C * 2, -        ) -    ) -) +cost_1 = A * X + B * Y +cost_2 = C * max(X, Y) * 2 +cost_3 = C * min(X, Y) * 2 + (X - min(X, Y)) * A + (Y - min(X, Y)) * B +print((min(cost_1, cost_2, cost_3)))