#include<bits/stdc++.h>
using namespace std;

int main()
{   long long n,m;
   while(~scanf("%lld %lld",&n,&m))
   {
		double ans=0;
	    	ans=(n*2+m)/4;
    	 printf("%.0lf\n",ans);
   }
	
	
	return 0;
}