Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. 

The manager of logging factory wants them to go to the jungle and cut *n* trees with heights *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. They bought a chain saw from a shop. Each time they use the chain saw on the tree number *i*, they can decrease the height of this tree by one unit. Each time that Kalila and Dimna use the chain saw, they need to recharge it. Cost of charging depends on the id of the trees which have been cut completely (a tree is cut completely if its height equal to 0). If the maximum id of a tree which has been cut completely is *i* (the tree that have height *a*<sub class="lower-index">*i*</sub> in the beginning), then the cost of charging the chain saw would be *b*<sub class="lower-index">*i*</sub>. If no tree is cut completely, Kalila and Dimna cannot charge the chain saw. The chainsaw is charged in the beginning. We know that for each *i* &lt; *j*, *a*<sub class="lower-index">*i*</sub> &lt; *a*<sub class="lower-index">*j*</sub> and *b*<sub class="lower-index">*i*</sub> &gt; *b*<sub class="lower-index">*j*</sub> and also *b*<sub class="lower-index">*n*</sub> = 0 and *a*<sub class="lower-index">1</sub> = 1. Kalila and Dimna want to cut all the trees completely, with minimum cost. 

They want you to help them! Will you?
The first line of input contains an integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>). The second line of input contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>). The third line of input contains *n* integers *b*<sub class="lower-index">1</sub>, *b*<sub class="lower-index">2</sub>, ..., *b*<sub class="lower-index">*n*</sub> (0 ≤ *b*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).

It's guaranteed that *a*<sub class="lower-index">1</sub> = 1, *b*<sub class="lower-index">*n*</sub> = 0, *a*<sub class="lower-index">1</sub> &lt; *a*<sub class="lower-index">2</sub> &lt; ... &lt; *a*<sub class="lower-index">*n*</sub> and *b*<sub class="lower-index">1</sub> &gt; *b*<sub class="lower-index">2</sub> &gt; ... &gt; *b*<sub class="lower-index">*n*</sub>.
MAXN = 100001

class pt(object):
  def __init__(self, x = 0, y = 0):
    self.x = x
    self.y = y

  def __sub__(self, other):
    return pt(self.x-other.x, self.y-other.y)

  def __mod__(self, other):
    return self.x * other.y - self.y * other.x

class duality(object):
  def __init__(self, N):
    self.T = [pt()] * N
    self.ini = 0
    self.fin = 0
  
  def add(self, x, y):
    p = pt(x, y)
    while self.fin - self.ini >= 2 and\
        (p-self.T[self.fin-1]) % (p-self.T[self.fin-2]) >= 0:
      self.fin -= 1
    self.T[self.fin] = p
    self.fin += 1

  def eval(self, i, x):
    return self.T[i].x * x + self.T[i].y

  def remove(self, x):
    while self.fin - self.ini >= 2 and\
        self.eval(self.ini, x) > self.eval(self.ini+1, x):
          self.ini += 1

n = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
solver = duality(n)

res_a = 0

for i in range(1, n):
  solver.add(-B[i-1], res_a)
  solver.remove(-A[i])
  res = solver.eval(solver.ini, -A[i])
  res_a = res

print(res)
