思路:
emm…瞎搞分类讨论推结论
代码:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map> // STL
#include <string>
#include <vector>
#include <queue>
#include <stack>
#define mpr make_pair
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
LL a,b,c;
LL n,m;
int main(){
cin>>a>>b>>c>>n>>m;
LL s=(a+b+c);
if((a+c)>n)s=n;
if((b+c)>m)s=min(s,m);
cout<<s<<endl;
return 0;
}