#1339
Unrated
The Great Wall
시간 제한
3s
메모리 제한
512MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Recently you had become an emperor of a small country of Sinai. You had decided to build a big wall at the border to save your country from barbarian raids. You had contacted "W Corp", the only company in the world that builds non-penetrable walls.

"W Corp" builds each wall using the same pattern. The length of the wall is nn meters. Each one-meter piece of the wall is numbered by an integer from 11 to nn along its length and may have a different height. The height pattern is based on three fixed arrays aa, bb, and cc of nn elements each, such that ai<bi<cia_i < b_i < c_i for all 1in1 \le i \le n, and an integer rr (1r<n1 \le r < n). These arrays and rr are the same for any wall that is built by "W Corp".

The choice of the specific wall design is determined by two distinct integers xx and yy (1x<ynr+11 \leq x < y \leq n - r + 1) in the following way. Take two ranges of integers: [x,x+r1][x, x + r - 1] and [y,y+r1][y, y + r - 1] (these ranges are inclusive of their ends). Then the height of the wall at one meter piece ii for all 1in1 \le i \le n is equal to:

  • aia_i if ii does not belong to any of the chosen ranges;
  • bib_i if ii belongs to exactly one chosen range;
  • cic_i if ii belongs to both chosen ranges.

A strength of a wall is defined as the sum of all heights of its nn one meter pieces.

The arrays aa, bb, cc, and an integer rr are the same for any wall built by "W Corp", so the company provides a price list with all the possible wall designs, sorted in non-decreasing order of their strength. You choose the kk-th wall design from the list. The task is to find the strength of the chosen wall.

입력

The first line of the input contains three integers nn, rr and kk (2n300002 \leq n \leq 30\,000, 1r<n1 \leq r < n, 1k(nr)(nr+1)21 \leq k \leq \frac{(n - r)(n - r + 1)}{2}) — the length of the wall, the length of the segments to choose, and the position of the wall in the price list.

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

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

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

출력

Print one integer — the strength of the kk-th wall from "W Corp" price list.

예제 입력 1

4 2 1
1 2 3 4
3 3 5 5
7 7 7 7

예제 출력 1

16

노트

In the sample test we could build three different walls:

  • The choice of x=1x = 1 and y=2y = 2 yields heights "3 7 5 4" with the strength of 19;
  • The choice of x=1x = 1 and y=3y = 3 yields heights "3 3 5 5" with the strength of 16;
  • The choice of x=2x = 2 and y=3y = 3 yields heights "1 3 7 5" with the strength of 16.
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.