#include #include using namespace std; struct cinema { int a,b,ans; }; int main() { int n,m,ans; int money[10001]; cinema C[100]; while(cin>>n>>m) { for(int i=0;i>C[i].a>>C[i].b; C[i].ans=((n+C[i].a-1)/C[i].a)*C[i].b; } ans=1e9; for(int i=0;i