#include<stdio.h>
#include<string.h>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn = 1e6+5;
struct node{
int jav;
int food;
double ave;
bool operator< (const node&I)const { //按照ave由da到xiao排列
return I.ave > ave; }
};
node a[maxn];
priority_queue <node> pque;
int main (){
int m, n;
double ans,m1;
node tem;
while (scanf("%d%d", &m, &n) != EOF && m != -1){
m1 = m;
while (!pque.empty() ) pque.pop() ;
for (int i = 0; i < n; i++){
scanf("%d%d", &a[i].jav , &a[i].food);
a[i].ave = a[i].jav / (double)a[i].food ;
pque.push(a[i]);
}
ans = 0;
while (!pque.empty() && m1 ){
tem = pque.top() ;
pque.pop() ;
if (m1 > tem.food ){
m1 -= tem.food ;
ans += tem.jav ;
}
else {
ans += m1*tem.ave ;
m1 = 0;
}
}
printf("%.3lf\n",ans);
}
}