#include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ll = long long;
using pi = pair<int, int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vpi = vector<pi>;
using sb = set<bool>;
using sc = set<char>;
using ss = set<string>;
using si = set<int>;
using sl = set<ll>;
using spi = set<pi>;
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
void solve() {
  ll mm = 1000000007;
  int n;
  cin >> n;
  map<pair<ll, ll>, int> m1, m2;
  set<pair<ll, ll>> s;
  int db0 = 0;
  for (int i = (1); i <= (n); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      db0++;
    } else {
      ll c = gcd(abs(a), abs(b));
      a /= c;
      b /= c;
      if (b < 0) {
        a = -a;
        b = -b;
      }
      if (a > 0 || (a == 0 && b > 0)) {
        m1[make_pair(a, b)]++;
        s.insert(make_pair(a, b));
      } else {
        m2[make_pair(b, -a)]++;
        s.insert(make_pair(b, -a));
      }
    }
  }
  ll db = 1;
  for (auto i : s) {
    int mm1 = m1[i], mm2 = m2[i];
    if (mm1 == 0) {
      ll c2 = binpow(2, m2[i], mm) % mm;
      db *= (c2) % mm;
    } else if (mm2 == 0) {
      ll c1 = binpow(2, m1[i], mm) % mm;
      db *= (c1) % mm;
    } else {
      ll c1 = binpow(2, m1[i], mm) % mm;
      ll c2 = binpow(2, m2[i], mm) % mm;
      db *= (c1 + c2 - 1) % mm;
    }
    db %= mm;
  }
  db += db0;
  db %= mm;
  cout << ((db - 1) % mm + mm) % mm << " ";
}
int main() {
  if (false) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  int t = 1;
  for (int asdasdasd_RaNdOm_VaRiAbLe_NaMe_asdasdasd = (1);
       asdasdasd_RaNdOm_VaRiAbLe_NaMe_asdasdasd <= ((t));
       asdasdasd_RaNdOm_VaRiAbLe_NaMe_asdasdasd++)
    solve();
  return 0;
}
