Burgers

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Kai the lobster is starting a burger chain selling burgers. He has nn ingredients to work with, which are labelled from 11 to nn. For each ingredient ii, he has x\[i]x\[i] portions of ingredient ii.

He has two recipes for burgers. For each ingredient ii, the first recipe requires a\[i]a\[i] portions of ingredient ii and the second recipe requires b\[i]b\[i] portions of ingredients ii.

Can you help Kai compute the maximum total number of burgers he can make?

입력

The first line of input consists of one integer nn, the number of different ingredients.

The second line consists of nn spaced integers x\[1],x\[2],,x\[n1],x\[n]x\[1], x\[2], \dots , x\[n - 1], x\[n], the total number of portions Kai has of each ingredient.

The third line consists of nn spaced integers a\[1],a\[2],,a\[n1],a\[n]a\[1], a\[2], \dots , a\[n - 1], a\[n], the number of portions of each ingredient for the first recipe.

The fourth line consists of nn spaced integers b\[1],b\[2],,b\[n1],b\[n]b\[1], b\[2], \dots , b\[n - 1], b\[n], the number of portions of each ingredient for the second recipe.

출력

The output should contain a single integer on a single line, the largest number of burgers Kai can make.

제한

  • 1n100,0001 ≤ n ≤ 100\\,000
  • 1x\[i],a\[i],b\[i]1091 ≤ x\[i], a\[i], b\[i] ≤ 10^9