uses crt;
const oneinch:longint=72;
var f:text;
   paperwidth,
   hoffset,
   oddsidemargin,
   textwidth,
   marginparsep,
   marginparwidth,
   hsomething,
   paperheight,
   voffset,
   topmargin,
   headheight,
   headsep,
   textheight,
   footskip,
   vsomething:longint;
begin
clrscr;
assign(f,'dimfile.txt');
rewrite(f);

writeln('please input parameters (pt, one-side printing):');
writeln(f,'layout parameters (pt, one-side printing):');
write('\paperwidth=');readln(paperwidth);
write('\oddsidemargin=');readln(oddsidemargin);
write('\marginparsep=');readln(marginparsep);
write('\marginparwidth=');readln(marginparwidth);
write('\paperheight=');readln(paperheight);
write('\topmargin=');readln(topmargin);
write('\headheight=');readln(headheight);
write('\headsep=');readln(headsep);
write('\footskip=');readln(footskip);
write('ATTENTION! What do you want: \textwidth=');readln(textwidth);

writeln(f,'\paperwidth=',paperwidth);
writeln(f,'\oddsidemargin=',oddsidemargin);
writeln(f,'\marginparsep=',marginparsep);
writeln(f,'\marginparwidth=',marginparwidth);
writeln(f,'\paperheight=',paperheight);
writeln(f,'\topmargin=',topmargin);
writeln(f,'\headheight=',headheight);
writeln(f,'\headsep=',headsep);
writeln(f,'\footskip=',footskip);
writeln(f,'ATTENTION! What do you want: \textwidth=',textwidth);

hoffset:=(paperwidth-2*oneinch-2*oddsidemargin-textwidth)div(2);
writeln('Your \hoffset=',hoffset);
writeln(f,'Your \hoffset=',hoffset);

voffset:=hoffset+oddsidemargin-topmargin;
writeln('Your \voffset=',voffset,' (if take header into account).');
writeln(f,'Your \voffset=',voffset,' (if take header into account).');
textheight:=paperheight-2*(oneinch+voffset+topmargin+headheight+headsep);
writeln('Your \textheight=',textheight,' (if take header into account).');
writeln(f,'Your \textheight=',textheight,' (if take header into account).');

voffset:=hoffset+oddsidemargin-topmargin-headheight-headsep;
writeln('Your \voffset=',voffset,' (if not take header into account).');
writeln(f,'Your \voffset=',voffset,' (if not take header into account).');
textheight:=paperheight-2*(oneinch+voffset+topmargin+headheight+headsep);
writeln('Your \textheight=',textheight,' (if not take header into account).');
writeln(f,'Your \textheight=',textheight,' (if not take header into account).');

close(f);
writeln('Done. Press [Enter]...');
readln;
end.