Вот так вот будет :)
Program gt; var f,ff:text;i,s,n:integer; begin assign(f,'input.txt');reset(f); assign(f,'input.txt');rewrite(ff); readln(f,n); close(f); s:=((1+n)*n)div 2; writeln(ff,s); close(ff); end.