#include <bits/stdc++.h>
const long double PI = 3.141592653589793236L;
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long int power(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) {
      res *= x;
      res %= 1000000007;
    }
    x *= x;
    x %= 1000000007;
    n = n >> 1;
  }
  return res;
}
void solve() {
  int N;
  cin >> N;
  vector<pair<long long int, long long int>> A(N);
  map<pair<long long int, long long int>, int> mp;
  set<pair<long long int, long long int>> S;
  int zero_count = 0;
  for (int i = 0; i < N; i++) {
    long long int a, b;
    cin >> a >> b;
    long long int GCD = 1;
    if (a != 0 && b != 0) GCD = gcd(abs(a), abs(b));
    A[i].first = a / GCD;
    A[i].second = b / GCD;
    if (A[i].second < 0) {
      A[i].first *= -1;
      A[i].second *= -1;
    }
    if (A[i].first == 0 && A[i].second == 0) {
      zero_count++;
    } else if (A[i].second == 0) {
      A[i].first = 1;
    } else if (A[i].first == 0) {
      A[i].second = 1;
    }
    S.insert(A[i]);
    mp[A[i]]++;
  }
  long long int ans = 1;
  vector<pair<long long int, long long int>> B;
  for (auto x : S) {
    B.push_back(x);
  }
  int M = B.size();
  set<pair<long long int, long long int>> S1;
  for (int i = 0; i < M; i++) {
    pair<long long int, long long int> bad = B[i];
    swap(bad.first, bad.second);
    bad.first *= -1;
    if (B[i].first == 0 && B[i].second == 0) {
      continue;
    }
    if (bad.second < 0) {
      bad.first *= -1;
      bad.second *= -1;
    }
    if (B[i].first == 0) {
      bad.first = 1;
      bad.second = 0;
    } else if (B[i].second == 0) {
      bad.first = 0;
      bad.second = 1;
    }
    if (S1.find(B[i]) != S1.end() && S1.find(bad) != S1.end()) {
      continue;
    }
    long long int n = mp[B[i]];
    long long int m = mp[bad];
    long long int x = 0;
    x += power(2, n);
    x %= 1000000007;
    x += power(2, m);
    x %= 1000000007;
    x--;
    ans *= x;
    ans %= 1000000007;
    S1.insert(B[i]);
    S1.insert(bad);
  }
  cout << ans - 1 + zero_count << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
