clear, clc
n=0;
x=-0.4;
a=1;
tot=a;
while abs(a)>1e-9
    n=n+1;
    a=(a*x)/n;
    tot=tot+a;
end
disp(tot);