while true
  n,r = gets.split(" ").map{|s| s.to_i}
  break if (n==0 && r==0)

  x1s,y1s,x2s,y2s = Array.new(n){gets.split(" ").map{|s| s.to_i}}.transpose

  xmax = x2s.max
  ymax = y2s.max

  s = 0
  a = Array.new(ymax){|y|
    Array.new(xmax){|x|
      cov = false
      for i in 0..n-1
        cov = (x1s[i]<=x && x<x2s[i] && y1s[i]<=y && y<y2s[i])
        break if cov
      end
      s += 1 if cov
      cov ? 1 : 0
    }
  }

  puts s
  puts (a+a.transpose).inject(0){|sum,arr| sum+=(arr.join.split("0")-[""]).size}*2
end