var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n").map(Number);
var a=arr.splice(0,4);
a.sort(function(a,b){
   return b-a;
});
var b=Math.max(arr[0],arr[1]);
console.log(a[0]+a[1]+a[2]+b);