uses
  SysUtils, TestLib;

procedure Normalize(var s : string);
var
  neg : boolean;
  i : integer;

begin
  if s[1] = '-' then begin
    neg := true;
    delete (s, 1, 1);
  end else
    neg := false;

  for i := 1 to length (s) do
    if not (s[i] in ['0'..'9']) then
      if neg then
        Quit (_PE, format('Недозволенный %d-й символ в "-', [i + 1]) + s + '".')
      else
        Quit (_PE, format('Недозволенный %d-й символ в "', [i]) + s + '".');

  while (length (s) > 1) and (s[1] = '0') do
    delete (s, 1, 1);

  if neg then
    s := '-' + s;
end;

function compress(a: string): string;
begin
	if length(a) <= 15 then
		result := a
	else
		result := copy(a, 1, 5) + '..[' + inttostr(length(a) - 10) + ' digits]..' + copy(a, length(a) - 5 + 1, length(a));

end;

var
  a, b : string;

begin
  a := ouf.ReadWord (blanks, blanks);
  b := ans.ReadWord (blanks, blanks);
  Normalize(a);
  Normalize(b);

  if a <> b then
    Quit (_WA, 'Ожидалось ' + compress(b) + ', получено ' + compress(a) + '.')
  else
    Quit (_OK, 'A + B = ' + compress(a) + '.');

end.
