def Hoa(n, m, S, a, b): tong = 0 for j in range(m): x, y = 0, n - 1 while x <= y: i = (x + y) // 2 if a[i] + b[j] <= S: x = i + 1 else: y = i - 1 if x > 0: tong = max(tong, a[x - 1] + b[j]) return tong n, m, S = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) kq = Hoa(n, m, S, a, b) print(kq) a,b = map(int, input().split()) g = (a+2)*(a+1)//2 print(g*(b+1))