#include <bits/stdc++.h>
using namespace std;
map<long double, long long> m1;
vector<pair<long double, long double> > v1;
long long getpow1(long long n, long long m, long long b) {
  if (m == 0) {
    return 1;
  }
  long long ans = getpow1(n, m / 2, b) % b;
  ans = (ans * ans) % b;
  if (m % 2 != 0) {
    ans = ans * n % b;
  }
  return ans % b;
}
map<long long, long long> m2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    long long n;
    cin >> n;
    for (long long i = 0; i < n; i++) {
      long double a, b;
      cin >> a >> b;
      v1.push_back(make_pair(a, b));
      m1[a / b]++;
    }
    long long ans = 1;
    for (long long i = 0; i < v1.size(); i++) {
      long double c1 = v1[i].first;
      long double c2 = v1[i].second;
      long double num1 = c1 / c2;
      c1 = (c2 / c1) * (-1.0);
      long long ans1 =
          (getpow1(2, m1[num1], 1000000007) + getpow1(2, m1[c1], 1000000007)) %
          1000000007;
      ans1 = (ans1 - 1 + 1000000007) % 1000000007;
      ans = (ans * ans1) % 1000000007;
      m1.erase(num1);
      m1.erase(c1);
    }
    cout << ans - 1;
  }
  return 0;
}
