program supernet;
var r,n,i,s:longint;
begin
readln(r,n);
s:=0;
for i:=3 to n do
    begin
    if 2*r mod i=0
       then begin
            s:=s+ (i*(i-1) div 2);
            end;
    end;
writeln(s);
end.