#include #include #include #include extern int getchar_unlocked(void); extern int putchar_unlocked(int); #define DEBUG3 #define NOP do{}while(0) #define gc(d) (d)=getchar_unlocked() #define pc(d) putchar_unlocked(d) #define PRINCR pc('\n') #ifdef DEBUG #include #define TRACE(...) do{fprintf(stderr,__VA_ARGS__);}while(0) #define TRACECR do{fprintf(stderr,"\n");}while(0) static clock_t startclock; void DEBUGSTART(void){TRACE("--DEBUG MODE --\n");startclock=clock();} void DEBUGEND(void){startclock=clock()-startclock;TRACE("--finish --\ntime is %.3fms\n",startclock/1000.);} #else #define TRACE(...) NOP #define TRACECR NOP void DEBUGSTART(void){return;} void DEBUGEND(void){return;} #endif #define NOCR(strig) do{char *p;p=strchr(strig,'\n');if(p)*p='\0';}while(0) #define SWAP(type,a,b) do{type _c;_c=a;a=b;b=_c;}while(0) #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define MID(a,b,c) ((a)>(b)?(b)>(c)?(b):(a)>(c)?(c):(a):(c)>(b)?(b):(c)>(a)?(c):(a)) #define REP(a,b) for(int a=0;a<(int)(b);++a) #define REP1(a,b) for(int a=1;a<=(int)(b);++a) static char *GETWORD(char* str) {char c;char *cp;cp=&str[0];gc(c);while(c!=EOF){if((c==' ')||(c=='\n'))break;*cp++=c;gc(c);}*cp='\0';return &str[0];} #define GETLINE(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0) #define mygc(c) (c)=getchar() static void read1(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);} static void read2(int *x, int *y){read1(x);read1(y);} #define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0) #define REP(a,b) for(int a=0;a<(int)(b);++a) #define lolong long long static int GETLINEINT(void) {char s[34];GETLINE(s);return atoi(s);} static int GETWORDINT(void) {char s[34];GETWORD(s);return atoi(s);} static long GETLINELONG(void) {char s[34];GETLINE(s);return atol(s);} static int cmpint123(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} static int cmpint321(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} #define ll long long #define ull unsigned ll #define ui unsigned int ll midl(ll a, ll b, ll c ) { if( a>b ) { if( b > c ) return b; else if( a > c ) return c; else return a; } else { if( c > b ) return b; else if( b > a ) return c; else return a; } } // ********************* // ********************* int main( void ) { ll N,A,B,C; ll md,mx,mn; char str[12*3+2]; // read N = GETLINELONG(); A = GETLINELONG(); { char c; char *cp; cp=&str[0]; gc(c); if( c == EOF ) { printf("\"assert\"\n"); return 0; } while(c!=EOF) { if((c==' ')||(c=='\n'))break; *cp++=c; gc(c); } *cp='\0'; } sscanf(str,"%lld",&B); C = GETLINELONG(); TRACE("N %ld\n",N); TRACE("A %ld\n",A); TRACE("B %ld\n",B); TRACE("C %ld\n",C); DEBUGSTART(); mx = MAX(A+B,MAX(A+C,B+C)); md = midl(A+B,A+C,B+C); mn = MIN(A+B,MIN(A+C,B+C)); TRACE("mx %ld\n",mx); TRACE("md %ld\n",md); TRACE("mn %ld\n",mn); if( mx == md ) { printf("%ld\n", mn ); } else { printf("%ld\n", md ); } DEBUGEND(); }