1482 {
1484 auto *lamp = new bool[2000001];
1485 memset(lamp, 0, 2000001 * sizeof(bool));
1487 for(
int i = 0; i <
n; i++) {
1488 double a;
1489 int t;
1490 cin >> a >> t;
1491 for(int j = 1; j <= t; j++) {
1492 const int at = a * j;
1493 lamp[at] = !lamp[at];
1494 }
1495 }
1496 for(int i = 0; i < 2000001; i++) {
1497 if(lamp[i]) {
1498 cout << i;
1499 break;
1500 }
1501 }
1502 delete[] lamp;
1503 return 0;
1504 }