#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  long long a, b, ans = n;
  vector<long long> s;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    s.push_back(a / b);
    s.push_back(-b / a);
  }
  sort(s.begin(), s.end());
  int flag = 0;
  vector<int> dob;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (flag == 0 and s[i] == s[i + 1]) {
      flag = 1;
      cnt = 2;
    } else if (s[i] == s[i + 1]) {
      cnt++;
    } else if (flag) {
      n -= cnt - 1;
      flag = 0;
    }
  }
  if (flag) n -= cnt - 1;
  long long ans1 = 1;
  for (int i = 0; i < n; i++) {
    ans1 *= 2;
    ans1 %= mod;
  }
  cout << (ans + ans1) % mod << endl;
}
