var m,n:word;begin repeat read(m,n);writeln((n*n+n)*(3*m-n+1)div 6+ord(n=6))until 1=0end.