Runaway Quail

Starting at zero on a line, catch every quail that flees outward at a speed below yours in the smallest possible total time.

Hard8Dynamic programmingMathIntervalsNo attempts yetTime limit5sMemory limit512 MB

Problem

All NN of your pet quail have gotten loose. You stand at position 00 on a number line, and quail ii starts at a nonzero integer position PiP_i, measured in meters. Every quail runs away from the point where you are at a constant speed of SiS_i meters per second, and it keeps running even while you are not chasing it.

You run at a constant speed of YY meters per second and you reverse direction instantly whenever you want. The moment you occupy the same point as a quail, that quail is caught, and catching it takes no extra time.

What is the minimum number of seconds it takes to catch every quail?

Input

The first line contains the number of test cases TT. TT test cases follow.

The first line of each test case contains your speed YY and the number of quail NN, separated by a space. The second line contains the positions P1,,PNP_1, \dots, P_N and the third line contains the speeds S1,,SNS_1, \dots, S_N, each separated by spaces.

Limits

  • 1T1001 \le T \le 100
  • 2Y1002 \le Y \le 100
  • 1N5001 \le N \le 500
  • 104Pi104-10^4 \le P_i \le 10^4 and Pi0P_i \ne 0
  • 1Si<Y1 \le S_i < Y

Output

For each test case, print one line in the form Case #x: y, where xx is the test case number starting from 11 and yy is the minimum number of seconds needed to catch every quail.

Round yy at the seventh digit after the decimal point and print exactly six digits after the decimal point. In every test file the answer is at least 5×1095 \times 10^{-9} away from a value where that rounding would go either way.