#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a > b) return gcd(b, a);
  if (a == 0) return b;
  return gcd(b % a, a);
}
void solve() {
  long long n;
  cin >> n;
  long long a, b;
  long long zero = 0;
  vector<long long> pow(n + 1, 0);
  pow[1] = 2;
  for (int i = 2; i <= n; i++) pow[i] = pow[i - 1] * 2 % mod;
  map<pair<int, int>, pair<int, int>> data;
  data[{0, 1}] = {0, 0};
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      zero++;
    else if (a == 0)
      data[{0, 1}].first++;
    else if (b == 0)
      data[{0, 1}].second++;
    else if ((a > 0) == (b > 0)) {
      if (a < 0) {
        a = -a;
        b = -b;
      }
      int g = gcd(a, b);
      a /= g;
      b /= g;
      if (data.find({a, b}) == data.end()) data[{a, b}] = {0, 0};
      data[{a, b}].first++;
    } else {
      long long temp = a;
      a = -b;
      b = temp;
      if (a < 0) {
        a = -a;
        b = -b;
      }
      int g = gcd(a, b);
      a /= g;
      b /= g;
      if (data.find({a, b}) == data.end()) data[{a, b}] = {0, 0};
      data[{a, b}].second++;
    }
  }
  long long ans = 1;
  for (auto p : data) {
    if (p.second.first == 0 && p.second.second == 0) continue;
    if (p.second.first == 0)
      ans = (ans * pow[p.second.second]) % mod;
    else if (p.second.second == 0)
      ans = (ans * pow[p.second.first]) % mod;
    else {
      long long now =
          (pow[p.second.first] - 1 + pow[p.second.second] - 1 + 1) % mod;
      ans = ans * now % mod;
    }
  }
  cout << ans + zero - 1 << endl;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  int t = 1;
  while (t > 0) {
    t--;
    solve();
  }
  return 0;
}
