Holi and Cultural Festival
Tag(s):

## Algorithms, Graph, Medium, Min-Cost Max_flow, Minimum Cost Maximum Flow

Problem
Editorial
Analytics

A cultural festival is going to be organized in Hacker Society on the day of Holi .The head of the society needs some Poets ,Dancers and some Musicians to perform in this event. He decides to interview N number of people who live in the society. Each one has ratings in all the three fields. He wants to choose right guys for the right job so that the festival can be celebrated in the best possible way.Thus he selects P Poets,D Dancers and M Musicians. Help him in organizing the event.

The strength of Cultural Festival is the sum of ratings of the people in the corresponding field. You have to maximize the sum of their ratings.

Input Format

First line contains 4 integers N,P,D,M.

Next 3 lines contain 3 arrays each of size N denoting the rating of the $ith$ person in the corresponding field. The first one is the ratings of N people on their poetry skill, next on their dancing skill and the third one on their music skills.

Output Format

Print an integer denoting the maximum sum of ratings that can be obtained

Constraints

$1 \le N,P,D,M \le 2000$

$1 \le P+D+M \le N$

$1 \le ratings \le 1000$

SAMPLE INPUT
3 1 1 1
1 2 3
1 3 3
4 5 6
SAMPLE OUTPUT
10

Explanation

Choose the 1st person for Poetry , 2nd for Dancing and 3rd for Music $(1+3+6=10)$ .

Or, you can also choose the 3rd person for Poetry , 2nd for Dancing and 1st for Music $(3+3+4=10)$ .

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

March Easy '18

OTHER PROBLEMS OF THIS CHALLENGE
• Basic Programming > Implementation
• Math > Number Theory
• Algorithms > Dynamic Programming
• Algorithms > Dynamic Programming

?