Program MultiplicationSquare;

Uses Crt,DOS;

{$I style.inc}

Var
  X,Y,W:Integer;

Procedure Usage;
Begin
  Style(0,1);
  Style(1,1);
  Style(3,1);
  WriteLn('mSquare v1.00 by Zebedee ',#$a9,'1994 Cybertek (11-Oct-94)');
  Style(0,1);
  WriteLn;
  WriteLn('Usage: MSQUARE <x> <y> <w>');
  Halt(10);
End;

Procedure GetParams;
Var
  ERR:Integer;
Begin
  If (ParamCount<>3) or (ParamStr(1)='?') Then Usage;
  Val(ParamStr(1),X,ERR);
  If ERR<>0 Then
  Begin
    WriteLn(ParamStr(0),': Invalid x setting');
    Halt(10);
  End;
  Val(ParamStr(2),Y,ERR);
  If ERR<>0 Then
  Begin
    WriteLn(ParamStr(0),': Invalid y setting');
    Halt(10);
  End;
  Val(ParamStr(3),W,ERR);
  If ERR<>0 Then
  Begin
    WriteLn(ParamStr(0),': Invalid w setting');
    Halt(10);
  End;
End;

Procedure Width(N,WD:Integer);
Var
  WB,C:Integer;
Begin
  If N<10 Then WB:=WD;
  If N>9 Then WB:=WD-1;
  If N>99 Then WB:=WD-2;
  If N>999 Then WB:=WD-3;
  For C:=1 To WB Do
    Write(' ');
  Write(N);
End;

Procedure MakeSquare;
Var
  CTX,CTY,CTR,CTC:LongInt;
Begin
  For CTC:=1 To W Do
    Write(' ');
  CTC:=0;
  Write('x');
  Style(1,1);
  For CTX:=2 To X Do
    Width(CTX,W);
  Style(1,0);
  WriteLn;
  For CTY:=2 To Y Do
  Begin
    Style(1,1);
    Width(CTY,W);
    Style(1,0);
    CTC:=CTY;
    For CTR:=2 To CTX Do
    Begin
      CTC:=CTC+CTY;
      Width(CTC,W);
    End;
    WriteLn;
  End;
End;
  
Begin
  GetParams;
  MakeSquare;
End.