#include #include main(){ int x,y; int x2,y2; scanf("%d%d%d%d",&x,&y,&x2,&y2); int step = std::max(x,y); if(x==y && x2==y2){step++;} printf("%d\n",step); }