PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000172. Tích nhỏ nhất (Minimum Product)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tích nhỏ nhất (Minimum Product)

Minimum Product

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

You are given two positive integers a,ba,b. You may perform at most nn operations. Each operation decreases either aa or bb by exactly 11. Throughout the process, a≥xa\ge x and b≥yb\ge y must remain true: neither value may be reduced below its respective lower bound.

You may perform fewer than nn operations. Find the minimum possible product a⋅ba\cdot b after the operations.

Input

The only line contains five integers a,b,x,y,na,b,x,y,n in this order; x,yx,y are the lower bounds and nn is the maximum number of operations.

Output

Print one integer: the minimum product achievable using at most nn operations.

Subtasks

  • Subtask 1 (20 points): 1≤a,b,x,y,n≤301\le a,b,x,y,n\le30; x≤ax\le a and y≤by\le b.
  • Subtask 2 (30 points): 1≤a,b,x,y,n≤1061\le a,b,x,y,n\le10^6; x≤ax\le a and y≤by\le b.
  • Subtask 3 (50 points): 1≤a,b,x,y,n≤1091\le a,b,x,y,n\le10^9; x≤ax\le a and y≤by\le b.

Examples

Input

10 10 8 5 3

Output

70

Explanation

Initially a=b=10a=b=10. We may lower aa by at most 22 and bb by at most 55. Spending all three operations on bb yields 10⋅7=7010\cdot7=70. Spending two on aa and one on bb yields 8⋅9=728\cdot9=72, which is larger. Therefore the minimum is 7070.