#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>

struct Blade
{
    int64_t m;
    int64_t h;
    bool operator<(const Blade &other) const
    {
        return h < other.h;
    }
};

int main()
{
    int64_t s, t, n;
    std::cin >> s >> t >> n;
    
    std::vector<Blade> blades(n);
    
    for(int i=0; i<n; i++)
    {
        std::cin >> blades[i].m >> blades[i].h;
    }
    std::sort(blades.begin(), blades.end());
    
    int64_t cur = t;
    double time = 0;
    
    for(int i=0; i<n; i++)
    {
        if(cur >= blades[i].m)
            continue;
        
        int64_t next = std::min(s, blades[i].m);
        time += (std::log(next) - std::log(cur)) / std::log(2.0) * blades[i].h;
        cur = next;
    }
    if(cur != s)
    {
        std::cout << "-1" << std::endl;
    }
    else
    {
        std::cout << std::setprecision(30) << time << std::endl;
    }
}
