/*
#include<stdio.h>
int main()
{
int arr[101][101]={};
int direct[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
int x, y, dx, dy;
int i,j,a, n,m,u=1, k=0;
scanf("%d %d",&n,&m);
for(i=0; i<n+2; i++ ) {
for(j=0; j<m+2; j++) {
if(i==0 || j==0 || i==n+1 || j==m+1) {
arr[i][j] = 9;
}
}
}
x = 1;
y = 1;
arr[x][y] = u++;
dx = direct[k][0];
dy = direct[k][1];
for(i=m*n -1; i>0; i--) {
if(arr[x+dx][y+dy] == 0) {
x+=dx;
y+=dy;
arr[x][y] = u++;
}
else {
k++;
k %= 4;
dx = direct[k][0];
dy = direct[k][1];
i--;
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
printf("%d ",arr[i][j]);
}
printf("\n");
}
return 0;
}
*/
#include<stdio.h>
int main()
{
char arr[8]={};
int j,k=0,i=0,d=0,l=0;
for(j=1;j<=7;j++)
{
scanf("%d",&arr[j]);
}
for(j=1;j<=7;j++)
{
if(j%2==0)
{
if(arr[j]>i)
{
i =arr[j];
}
}
if(j%2==1)
{
if(arr[j]>d)
{
d = arr[j];
}
}
}
printf("%d",i+d);
return 0;
}