#include <iostream>
usingnamespace std;
int main()
{
int arr[5];
int sum[5];
int s=0;
for(int i=0; i<5; i++)
{
cin>>arr[i];
}
for (int i = 0; i < 5; i++)
{
for (int j = 0; i < 5; j++)
{
if(arr[j]==arr[i])
{
continue;
}
s=s+arr[j];
}
sum[i]=s;
}
//sorting array
for(int i=0;i<5;i++)
{
for(int j=i+1;j<5;j++)
{
if(sum[i]>arr[j])
{
int temp =sum[i];
sum[i]=sum[j];
sum[j]=temp;
}
}
}
cout<<"Minimum sum is "<<sum[0]<<" and maximum sum is "<<sum[4];
return 0;
}