#include<algorithm>
#include<cstdio>


using namespace std ;


int main( void )
{
	int a ,b ,c ,d ;
	scanf( "%d %d %d %d" ,&a ,&b ,&c ,&d ) ;

	a = ( a + b + c + d ) - min( a ,min( b ,min( c ,d ) ) ) ;

	scanf( "%d %d" ,&b ,&c ) ;

	printf( "%d\n" ,a + max( b ,c ) ) ;


	return 0 ;
}