program trys_sodininkai;
  { 154 u‘davinys }

  const DUOM = 'SODAS.DAT';
  type  taskas = record
                   x, y: integer
                 end;
        sklypas = record { apatinio ir viržutinio kampo koordinat‚s }
                    ap, vi: taskas
                  end;

  function min (a, b, c: integer): integer;
  { randa ma‘iausi… iž trij— skai‡i— }
  begin
    if (a <= b) and (a <= c)
       then min := a
       else if b <= c then min := b
                      else min := c
  end; { min }

  function max (a, b, c: integer): integer;
  { randa did‘iausi… iž trij— skai‡i— }
  begin
    if (a >= b) and (a >= c)
       then max := a
       else if b >= c then max := b
                      else max := c
  end; { max }

  function vaismedziai (s1, s2, s3: sklypas): integer;
  { kelis vaismed‘ius pri‘i–r‚s visi sodininkai }
    var b: sklypas;
  begin
    { randame sklypo, priklausan‡io visiems trims sklypams, koordinates }
    b.ap.x := max (s1.ap.x, s2.ap.x, s3.ap.x);
    b.ap.y := max (s1.ap.y, s2.ap.y, s3.ap.y);
    b.vi.x := min (s1.vi.x, s2.vi.x, s3.vi.x);
    b.vi.y := min (s1.vi.y, s2.vi.y, s3.vi.y);
    if (b.vi.x < b.ap.x) or (b.vi.y < b.vi.y)
       then vaismedziai := 0
       else vaismedziai := (b.vi.x - b.ap.x) * (b.vi.y - b.ap.y)
  end; { vaismed‘iai }

  var f: text;
      s1, s2, s3: sklypas;
begin
  assign (f, DUOM);
  reset (f);
  readln (f, s1.ap.x, s1.ap.y, s1.vi.x, s1.vi.y);
  readln (f, s2.ap.x, s2.ap.y, s2.vi.x, s2.vi.y);
  readln (f, s3.ap.x, s3.ap.y, s3.vi.x, s3.vi.y);
  writeln (vaismedziai(s1, s2, s3));
end.

