#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E16;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long po(long long i, long long p) {
  if (p == 0)
    return 1;
  else {
    i = mod(i);
    if (p == 1) return i;
    if (p % 2 == 0) return po(mod(i * i), p / 2);
    return mod(i * po(i, p - 1));
  }
}
long long bunbo(long long n) { return po(n, (long long)(1E9 + 7) - 2); }
long long n;
long long a[200005], b[200005];
void guc() {
  long long cnt = 0;
  for (long long i = 1; i <= (1 << n) - 1; i++) {
    vector<pair<long long, long long> > v;
    for (long long j = 0; j <= n - 1; j++) {
      if ((i >> j) & 1) v.push_back({a[j], b[j]});
    }
    long long vs = v.size();
    bool f = true;
    for (long long j = 0; j <= vs - 1; j++) {
      for (long long k = j + 1; k <= vs - 1; k++) {
        if (v[j].first * v[k].first + v[j].second * v[k].second == 0) f = false;
      }
    }
    if (f) cnt++;
  }
  cout << cnt << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i <= n - 1; i++) cin >> a[i] >> b[i];
  bool f = false;
  long long A = 0, B = 0;
  vector<pair<long long, long long> > v;
  for (long long i = 0; i <= n - 1; i++) {
    if (a[i] == 0 && b[i] == 0) {
      f = true;
      continue;
    }
    if (a[i] == 0) {
      A++;
    } else if (b[i] == 0) {
      B++;
    } else {
      if (b[i] < 0) {
        b[i] *= -1;
        a[i] *= -1;
      }
      long long g = gcd(abs(a[i]), abs(b[i]));
      a[i] /= g;
      b[i] /= g;
      v.push_back({a[i], b[i]});
    }
  }
  sort(v.begin(), v.end());
  long long ans = po(2, A) + po(2, B) - 1;
  ans = mod(ans);
  long long vs = v.size();
  map<pair<long long, long long>, long long> mp;
  for (long long i = 0; i <= vs - 1; i++) {
    long long c = 1;
    while (i <= vs - 2) {
      if (v[i] == v[i + 1]) {
        i++;
        c++;
      } else
        break;
    }
    mp[v[i]] = c;
  }
  set<pair<long long, long long> > used;
  for (auto X : mp) {
    pair<long long, long long> x = X.first;
    long long cnt = X.second;
    if (cnt == 0) continue;
    if (used.find(x) != used.end()) continue;
    pair<long long, long long> ser = {-x.second, x.first};
    if (ser.second < 0) {
      ser.first *= -1;
      ser.second *= -1;
    }
    if (mp.find(ser) == mp.end()) {
      ans = mod(ans * po(2, cnt));
    } else {
      long long op = mp[ser];
      long long ad = po(2, cnt) + po(2, op) - 1;
      ad = mod(ad);
      ans = mod(ans * ad);
      used.insert(ser);
    }
  }
  if (f) ans++;
  cout << mod(ans - 1) << "\n";
  return 0;
}
