#include <iostream>
#include<cstdio>
using namespace std;
typedef long long LL;
int main()
{
LL sum=0;
int w,n;
scanf("%d",&w);
scanf("%d",&n);
while(n--)
{
int a,b;
scanf("%d%d",&a,&b);
sum+=a*b;
}
cout<<sum/w<<endl;
return 0;
}
#include<cstdio>
using namespace std;
typedef long long LL;
int main()
{
LL sum=0;
int w,n;
scanf("%d",&w);
scanf("%d",&n);
while(n--)
{
int a,b;
scanf("%d%d",&a,&b);
sum+=a*b;
}
cout<<sum/w<<endl;
return 0;
}