var
i,j:longint;
n,m,d:int64;
f:array[0..1000000]of int64;
function min(x,y:longint):longint;
begin
if x<y then exit(x);
exit(y);
end;
begin
assign(input,'parents.in'); reset(input);
assign(output,'parents.out'); rewrite(output);
readln(n,m,d);
for i:=min(n,m) downto d do
begin
f[i]:=(n div i)*(m div i);
for j:=2 to min(n div i,m div i) do
dec(f[i],f[i*j]);
end;
writeln(f[d]);
close(input);
close(output);
end.