// Arup Guha
// 2/25/2023
// Solution to 2022 SER D2 Problem: Food Processor

import java.util.*;
import java.io.*;

public class foodprocessor {

	public static void main(String[] args) throws Exception {
	
		// Read basic info.
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		int start = Integer.parseInt(tok.nextToken());
		int target = Integer.parseInt(tok.nextToken());
		int n = Integer.parseInt(tok.nextToken());
		
		// Read in all items and sort.
		ArrayList<item> list = new ArrayList<item>();
		for (int i=0; i<n; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int maxP = Integer.parseInt(tok.nextToken());
			int half = Integer.parseInt(tok.nextToken());
			list.add(new item(maxP, half));
		}
		Collections.sort(list);
		
		// We might always have to use the first item.
		ArrayList<item> useful = new ArrayList<item>();
		useful.add(list.get(0));
		
		// From here only add if our rate gets better.
		for (int i=1; i<n; i++) {
			if (list.get(i).mPiece <= target) break;
			if (list.get(i).beat(useful.get(useful.size()-1))) 
				useful.add(list.get(i));
		}
		
		// Screen out this case.
		if (useful.get(0).mPiece < start)
			System.out.println(-1);
			
		// Regular case.
		else {
		
			// Use best starting blade.
			int i = 0;
			while (i<useful.size() && useful.get(i).mPiece >= start) i++;
			i--;
			
			// Now cut until you get to next better blade.
			double res = 0;
			int curS = start;
			while (i+1<useful.size()) {
				
				// The new piece size.
				int newS = useful.get(i+1).mPiece;
				
				// Time to get it down to that.
				res += (useful.get(i).halfTime* ( Math.log(1.0*curS/newS)/Math.log(2) ) );
				
				// Update current size.
				curS = newS;
				i++;
			}
			
			// Last cuts.
			int sz = useful.size();
			res +=  ( useful.get(sz-1).halfTime* ( Math.log(1.0*curS/target)/Math.log(2) ) );
			
			// Ta d!
			System.out.println(res);
		}
	}
}

class item implements Comparable<item> {
	
	public int mPiece;
	public int halfTime;
	
	public item(int m, int h) {
		mPiece = m;
		halfTime = h;
	}
	
	public int compareTo(item other) {
		if (mPiece != other.mPiece) return other.mPiece - mPiece;
		return halfTime - other.halfTime;
	}
	
	public boolean beat(item other) {
		return this.halfTime < other.halfTime && this.mPiece < other.mPiece;
	}
}
