#include <iostream>
#include <cstdio>
#include <algorithm>
#define MAX 1000

using namespace std;



struct Room{
    int j;
    int f;
    double rate;
};

bool cmp(Room a, Room b){
    return a.rate > b.rate;
}

Room rooms[MAX];

int main(){
    int m, n;
    int ans; 
    while (cin >> m >> n) {
        int j[MAX], f[MAX];
        double ans = 0;
        if(m == -1 || n == -1) return 0;
        for(int i = 0; i < n; i++){
            cin >> rooms[i].j >> rooms[i].f;
            rooms[i].rate = rooms[i].j / (rooms[i].f * 1.0);
        }
        sort(rooms, rooms + n, cmp);
        for(int i = 0; i < n; i++){
            //cout << rooms[i].j << rooms[i].f << endl;
            if(m == 0){
                break;
            }else if(m >= rooms[i].f){
                m -= rooms[i].f;
                ans += rooms[i].j;
                //printf("%.3f\n", ans);
            }else{
                ans += m / (rooms[i].f * 1.0) * rooms[i].j ;
                m = 0;
            }
        }
        printf("%.3f\n", ans);
    }
    return 0; 
}