Water Tank

Find the smallest constant drain rate R so the tank never exceeds capacity C while inflow runs through n phases.

Medium6Binary searchPrefix sumMathNo attempts yetTime limit2sMemory limit512 MB

Problem

A water tank with capacity CC liters is empty. At time 0 water starts flowing in through a pipe. The inflow is divided into nn consecutive phases numbered 0 to n1n-1. Phase ii lasts t[i]t[i] seconds, and during that phase the tank receives x[i]x[i] liters per second.

The tank has one outlet with a valve. The valve releases RR liters per second, where RR is a real number that is at least 0. You set RR before the water starts flowing and cannot change it until the inflow ends. While the tank is empty nothing drains out, so the stored amount never drops below 0.

Find the smallest RR for which the stored amount never exceeds CC liters at any moment.

Input

The first line contains nn and CC. (1n501 \le n \le 50, 1C1091 \le C \le 10^9)

The second line contains t[0],t[1],,t[n1]t[0], t[1], \dots, t[n-1], and the third line contains x[0],x[1],,x[n1]x[0], x[1], \dots, x[n-1]. (1t[i],x[i]1061 \le t[i], x[i] \le 10^6)

Output

Print the smallest RR on the first line as an irreducible fraction p/qp/q. Here pp and qq are integers with q1q \ge 1 and gcd(p,q)=1\gcd(p, q) = 1. Print the denominator even when the answer is an integer or 0. An answer of 0 is printed as 0/1, and an answer of 2 is printed as 2/1.