#include using namespace std; int main(){ int n, m; int counter = 0; cin>>m>>n; for(int x=0; x<=m; x++) for(int y=x; y<=m; y++) for(int z=y; z<=m; z++) if(x*x+y*y==z*z) counter++; counter+=(m+1)*(n-2);//ker grejo vse potence 0*0+0*0=0*0 in 1*1+1*1=1*1 cout<