while true
  n,r = gets.split(" ").map{|i| i.to_i}
  break if n==0 && r==0
  
  field = Array.new(100){Array.new(100){0}}
  xmax,ymax = 100,100
  
  s = 0
  for i in 1..n
    x1,y1,x2,y2 = gets.split(" ").map{|i| i.to_i}  
    (field += Array.new(y2-ymax){Array.new(xmax){0}} ; ymax = y2) if y2 > ymax
    (field.map!{|arr| arr+Array.new(x2-xmax){0}} ; xmax = x2) if x2 > xmax
    for x in x1..x2
      for y in y1..y2
        (field[x][y] = 1 ; s+=1) if field[x][y] == 0
      end
    end
  end
  puts s
  
  end
          
  
  