#include<iostream>
using namespace std;
void swap(int &x,int &y){ int z=x; x=y; y=z; }
int main(){
int a,b,c,d,e;
while(cin>>a>>b>>c>>d>>e){
if(a>b) swap(a,b);
if(c>d) swap(c,d);
if(b>d){ b=d; swap(a,c); }
if(c>e) swap(c,e);
if(b>e){
if(a>e) cout<<a<<endl;
else cout<<e<<endl;
}
else{
if(b>c) cout<<b<<endl;
else cout<<c<<endl;
}
}
return 0;
}