public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		do {
			line = in.readLine();
			if (line == null || line.length() == 0 || line.equals("0"))
				break;
			int[] sizer = retInts(line);
			int[] front = retInts(in.readLine());
			int[] rear = retInts(in.readLine());
			double[] all = new double[sizer[0] * sizer[1]];
			int index = 0;
			for (int i = 0; i < front.length; i++)
				for (int j = 0; j < rear.length; j++)
					all[index++] = (1.0 * rear[j]) / front[i];
			Arrays.sort(all);
			double maxSpread = 0;
			for (int i = 0; i < all.length-1; i++)
				maxSpread = Math.max(maxSpread, all[i+1] / all[i]);
			System.out.printf(Locale.US, "%.2f\n", maxSpread);
		} while (line != null && line.length() != 0);
	}