The Great Wall

Each design picks two length-r intervals whose overlap height adds extra cost; find the k-th smallest total wall height over all interval pairs.

Hard8Binary searchPrefix sumDynamic programmingSortingNo attempts yetTime limit3sMemory limit512 MB

Problem

You have become the emperor of Sinai, a small country. To stop the raids coming across the border you decided to build a great wall there, and you hired W Corp, the only company in the world that builds walls nobody can break through.

W Corp builds every wall from the same pattern. The wall is nn meters long, and each one meter piece is numbered from 11 to nn along its length. Pieces may have different heights. The heights come from three fixed arrays aa, bb, cc of nn elements each, with ai<bi<cia_i < b_i < c_i for every 1in1 \le i \le n, and from an integer rr (1r<n1 \le r < n). The three arrays and rr are the same for every wall W Corp builds.

A specific design is fixed by two integers xx and yy with 1x<ynr+11 \le x < y \le n - r + 1. Take the two ranges [x,x+r1][x, x+r-1] and [y,y+r1][y, y+r-1], both inclusive. The height of piece ii is:

  • aia_i if ii lies in neither range,
  • bib_i if ii lies in exactly one of the ranges,
  • cic_i if ii lies in both ranges.

The strength of a wall is the sum of the heights of its nn pieces.

Because aa, bb, cc and rr never change, W Corp hands you a price list of every possible design sorted in non-decreasing order of strength. You pick the kk-th design on that list. Report the strength of the wall you picked.

Input

The first line contains three integers nn, rr, kk (2n300002 \le n \le 30000, 1r<n1 \le r < n, 1k(nr)(nr+1)21 \le k \le \frac{(n-r)(n-r+1)}{2}): the length of the wall, the length of the chosen ranges, and the position on the price list.

The second line contains the nn elements of the array aa (1ai1061 \le a_i \le 10^6).

The third line contains the nn elements of the array bb (ai<bi106a_i < b_i \le 10^6).

The fourth line contains the nn elements of the array cc (bi<ci106b_i < c_i \le 10^6).

Output

Print one integer, the strength of the kk-th wall on the price list. Several designs can share the same strength, and the kk-th strength value is the same whichever way those ties are ordered.

Hint

In the first example there are three walls you can build.

  • Choosing x=1x = 1 and y=2y = 2 gives the heights 3 7 5 43\ 7\ 5\ 4 and the strength 1919.
  • Choosing x=1x = 1 and y=3y = 3 gives the heights 3 3 5 53\ 3\ 5\ 5 and the strength 1616.
  • Choosing x=2x = 2 and y=3y = 3 gives the heights 1 3 7 51\ 3\ 7\ 5 and the strength 1616.