#include #include #include #include #include #include using namespace std; typedef long long LL; typedef vector VI; #define REP(i,n) for(int i=0; i 1) { int m = (lo + hi) / 2; int f = max(0, R-m)/2 + max(0, G-m)/2 + max(0, B-m)/2; int z = max(0, m-R) + max(0, m-G) + max(0, m-B); if (z <= f) lo = m; else hi = m; } printf("%d\n", A + lo); return 0; }