#include <bits/stdc++.h>
using namespace std;
int N;
map<pair<long long int, long long int>, int> mappa;
int num00;
long long int pow2[300000];
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  cin >> N;
  long long int a, b;
  pair<long long int, long long int> c;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      num00++;
    else if (a == 0)
      c = make_pair((long long int)0, (long long int)1);
    else if (b == 0)
      c = make_pair((long long int)1, (long long int)0);
    else {
      long long int x = gcd(abs(a), abs(b));
      if (a < 0) {
        a = -a;
        b = -b;
      }
      c = make_pair(a / x, b / x);
    }
    if (mappa.find(c) != mappa.end())
      mappa[c]++;
    else
      mappa[c] = 1;
  }
  pow2[0] = (long long int)1;
  for (int i = 1; i <= N; i++)
    pow2[i] = (pow2[i - 1] * (long long int)2) % 1000000007;
  long long int res = 1;
  map<pair<long long int, long long int>, int>::iterator it;
  set<pair<long long int, long long int> > used;
  for (it = mappa.begin(); it != mappa.end(); it++) {
    c = it->first;
    long long int x = it->second;
    if (used.find(c) != used.end()) continue;
    pair<long long int, long long int> opposite = make_pair(-c.second, c.first);
    if (opposite.first < 0) {
      opposite.first = -opposite.first;
      opposite.second = -opposite.second;
    } else if (opposite.first == 0)
      opposite.second = 1;
    if (mappa.find(opposite) == mappa.end()) {
      res = (res * pow2[x]) % 1000000007;
      used.insert(c);
    } else {
      long long int y = mappa[opposite];
      res = (res * (pow2[x] + pow2[y] + 1000000007 - 1)) % 1000000007;
      used.insert(c);
      used.insert(opposite);
    }
  }
  res = (res + num00 + 1000000007 - 1) % 1000000007;
  cout << res << endl;
  return 0;
}
