require 'set'
require 'mathn'

loop do
	w, h, n = gets.split.map &:to_i
	break if n == 0
	
	points = (1..2*n).map { gets.split.map &:to_i } + [[w, 0], [w, h]]
	
	ys = Set[0, h]
	points.combination(2) do |(x1, y1), (x2, y2)|
		next if x1 == x2	
		y = y1 - x1 * (y2 - y1) / (x2 - x1)
		ys << y if 0 < y && y < h
	end		
	2.times { points.pop }

	s = 0
	ys.sort.each_cons(2) do |y1, y2|
		a = points.map do |u, v|
			if u == 0
				if v == y1
					[u, v, -Float::INFINITY]
				else
					[u, v, Float::INFINITY]
				end
			else
				 [u, v, (w - u) * (v - y1) / u + v]
			end
		end
		a.sort_by!(&:last)

		u1, v1, r_y1 = a[n-1]
		u2, v2, r_y2 = a[n]

		#p [(w-u1).to_f*(v1-y1)/u1+v1,(w-u2).to_f*(v2-y1)/u2+v2,(w-u1).to_f*(v1-y2)/u1+v1,(w-u2).to_f*(v2-y2)/u2+v2]

		if r_y1 > h
				#do nothing
		elsif r_y1 > 0
			if r_y2 > h
				s += (y2-y1) * (h - v1*w/u1 + (w/u1-1)*(y2+y1)/2)
			else
				s += w * (y2-y1) * (v2/u2 - v1/u1 + (1/u1-1/u2)*(y2+y1)/2)
			end
		else
			if r_y2 > h
				s += (y2 - y1) * h
			elsif r_y2 > 0
				s += (y2-y1) * (v2*w/u2 + (1-w/u2)*(y2+y1)/2)
			else
				#do nothing
			end
		end
	end
	puts (s / (h * h)).to_f
end