#include<iostream>
using namespace std;
int main(){
freopen("ufo.in","r",stdin);
freopen("ufo.out","w",stdout);
int n,m,mi=0;
cin>>n>>m;
while(n>0&&m>0){
if(n<m){
n+=1;
m-=2;
mi+=1;
}
else{
n-=2;
m+=1;
mi+=1;
}
}
cout<<mi;
fclose(stdin);
fclose(stdout);
return 0;
}