#include<bits/stdc++.h>
#define int long long
#define il inline
#define re register
using namespace std;
const int k = 10000;
struct node {
int a, b;
bool operator < (const node x) const {
return a * b < x.a * x.b;
}
};
node a[1005], x;
int n, sum[1000005], top, tmp[1000005], ans[1000005], idx, tot;
bool pd () {
if (tot != idx) return top > idx;
for (int i = idx; i >= 1; -- i) {
if (tmp[i] != ans[i]) {
return tmp[i] > ans[i];
}
}
return 0;
}
void mul (int x) {
for (int i = 1; i <= top; ++ i) {
sum[i] *= x;
sum[i + 1] += sum[i] / k;
sum[i] %= k;
}
while (sum[top + 1]) ++ top, sum[top + 2] += sum[top + 1] / k, sum[top + 1] %= k;
return;
}
void chu (int x) {
int cnt = 0;
for (int i = tot; i >= 1; -- i) {
cnt = cnt * k + sum[i];
tmp[i] = cnt / x;
cnt %= x;
}
while (!tmp[tot]) -- tot;
return;
}
signed main(){
cin >> n;
cin >> x.a >> x.b;
for (int i = 1; i <= n; ++ i) cin >> a[i].a >> a[i].b;
sort(a + 1, a + n + 1);
int p = x.a;
do {
sum[++ top] = p % k;
p /= k;
} while (p);
for (int i = 1; i <= n; ++ i) {
for (int j = 1; j <= top; ++ j) tmp[j] = 0;
tot = top;
chu(a[i].b);
if (pd()) {
for (int j = 1; j <= tot; ++ j) ans[j] = tmp[j];
idx = tot;
}
mul(a[i].a);
}
for (int i = idx; i >= 1; -- i) cout << ans[i];
return 0;
}