Problem:
Score : 500 points

Problem Statement

You are going to eat X red apples and Y green apples.

You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C.

Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.

From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.

Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.

Constraints

1 \leq X \leq A \leq 10^5

1 \leq Y \leq B \leq 10^5

1 \leq C \leq 10^5

1 \leq p_i \leq 10^9

1 \leq q_i \leq 10^9

1 \leq r_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X Y A B C
p_1 p_2 ... p_A
q_1 q_2 ... q_B
r_1 r_2 ... r_C

Output

Print the maximum possible sum of the deliciousness of the eaten apples.

Sample Input 1

1 2 2 2 1
2 4
5 1
3

Sample Output 1

12

The maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:

Eat the 2-nd red apple.

Eat the 1-st green apple.

Paint the 1-st colorless apple green and eat it.

Sample Input 2

2 2 2 2 2
8 6
9 1
2 1

Sample Output 2

25

Sample Input 3

2 2 4 4 4
11 12 13 14
21 22 23 24
1 2 3 4

Sample Output 3

74

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

// fn read_line() -> String {
//     let mut s = String::new();
//     std::io::stdin().read_line(&mut s).unwrap();
//     s
// }

// fn split_whitespace(line: String) -> Vec<u32> {
//     line.split_whitespace()
//         .map(|s| s.parse().unwrap())
//         .collect()
// }

// fn reader() -> Vec<usize> {
//     let mut buffer = String::new();
//     io::stdin().read_to_string(&mut buffer);

//     let st: Vec<&str> = buffer.lines().collect();

//     let s: Vec<&str> = st.get(1).unwrap().clone().split_terminator(" ").collect();

//     s.iter()
//         .map(|v| v.trim().parse::<usize>().unwrap())
//         .collect()
// }

// fn solver(mut hs: Vec<usize>) -> usize {
//     let mut v: Vec<usize> = vec![0; hs.len()];;

//     for i in 1..hs.len() {
//         if hs[i - 1] >= hs[i] {
//             v[i] = v[i - 1] + 1;
//         }
//     }

//     let max = v.iter().max().unwrap().clone();
//     println!("{}", max);
//     max
// }

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

fn main() {
    let mut sc = IO::new(std::io::stdin(), std::io::stdout());
    let opts: Vec<usize> = sc.vec(5);

    let (x, y, r, g, c) = (opts[0], opts[1], opts[2], opts[3], opts[4]);

    let mut rs: Vec<usize> = sc.vec(r);
    let mut gs: Vec<usize> = sc.vec(g);
    let mut cs: Vec<usize> = sc.vec(c);

    rs.sort();
    gs.sort();
    cs.sort();

    rs.reverse();
    gs.reverse();
    cs.reverse();

    // println!("{:?}", rs);
    // println!("{:?}", gs);
    // let rs_top: &usize = &rs[..x].iter().sum::<usize>();
    // let gs_top: &usize = &gs[..y].iter().sum::<usize>();
    // let mut total = rs_top + gs_top;

    // let cap = std::cmp::min(std::cmp::max(x, y), cs.len());

    let mut b = rs
        .iter()
        .chain(&gs[..])
        .chain(&cs[..])
        .cloned()
        .collect::<Vec<usize>>();
    b.sort();
    b.reverse();

    // println!("{:?}", b.iter().take(x + y).sum::<usize>());

    // for (i, item) in cs[..cap].iter().enumerate() {
    //     match (rs.get(i), gs.get(i)) {
    //         (Some(r), Some(g)) => {
    //             let min = std::cmp::min(r, g);
    //             if min < item {
    //                 total = total + (item - min);
    //             }
    //         }
    //         (Some(r), None) => {
    //             if r < item {
    //                 total = total + (item - r);
    //             }
    //         }
    //         (None, Some(r)) => {
    //             if r < item {
    //                 total = total + (item - r);
    //             }
    //         }
    //         _ => unreachable!(),
    //     }
    //     // if let Some(v) = rs.get(i) {
    //     //     if item > v {
    //     //         total = total + (item - v);
    //     //     }
    //     // }
    // }
    // println!("{} {} {}", &rs_top, &gs_top, &cap);
    // let cs_top: &usize = &cs[..cap].iter().sum::<usize>();

    sc.write(b.iter().take(x + y).sum::<usize>());
}

#[test]
fn evls() {
    assert_eq!(1, 2);
}

// #[cfg(test)]
// mod tests {
//     use super::*;

//     #[test]
//     fn fst() {
//         assert_eq!(solver(vec![4, 4, 5, 6, 6, 5, 5]), 3);
//     }

//     #[test]
//     fn snd() {
//         assert_eq!(solver(vec![10, 4, 8, 7, 3]), 2);
//     }

//     #[test]
//     fn thrd() {
//         assert_eq!(solver(vec![1, 2, 3, 4]), 0);
//         assert_eq!(solver(vec![1, 2]), 0);
//     }
// }