


process.stdin.resume();
process.stdin.setEncoding('utf8');


process.stdin.on('data', function (chunk) {
    let n = chunk.toString() // 文字列化する
        .split("\n") // \nで分割
        .map(x => Number(x));
    // .filter(x => x !== );

    let data = n.slice(0, 4);
    let b = n.slice(4, 6);
    data.sort((a, b) => a - b);
    const e = data.slice(1, 5);
    if (b[0] < b[1]) {
        const ans = e[0] + e[1] + e[2] + b[1];
        console.log(ans);

    } else if (b[0] > b[1]) {
        const ans = e[0] + e[1] + e[2] + b[0];
        console.log(ans);
    } else if(b[0] === b[1]){
        const ans = e[0] + e[1] + e[2] + b[0];
        console.log(ans);
    }


})
