using System.Collections.Generic; using System; public class hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var m = int.Parse(line[1]); var c = long.Parse(line[2]); line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, long.Parse); line = (Console.ReadLine().Trim() + " 0").Split(' '); var b = Array.ConvertAll(line, long.Parse); Array.Sort(b); getAns(n, m, c, a, b); } static void getAns(int n, int m, long c, long[] a, long[] b) { var count = 0L; for (int i = 0; i < n; i++) { var t = c / a[i]; if (t * a[i] <= c) t++; var p = LowerBound(b, t); if (p != m + 1) count += m - p + 1; } var ans = (double)count / n / m; Console.WriteLine(ans); } public static int LowerBound(T[] arr, int start, int end, T value, IComparer comparer) { int low = start; int high = end; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (comparer.Compare(arr[mid], value) < 0) low = mid + 1; else high = mid; } return low; } public static int LowerBound(T[] arr, T value) where T : IComparable { return LowerBound(arr, 0, arr.Length, value, Comparer.Default); } }