#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq = priority_queue<T, vector<T>, greater<T>>;
using ll = long long;
using ld = long double;
using UnWeightedGraph = vector<vector<long long>>;
ll INF = LLONG_MAX / 4 - 100;
long long IINF = INT_MAX / 4;
ll mod = 1e9 + 7;
long long dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
vector<ll> prime;
long double pi = 3.141592653589793238;
class fact {
 public:
  long long fmod = 1e9 + 7;
  vector<long long> fac, finv, inv;
  fact(long long n, long long Mod = 1e9 + 7) {
    fmod = Mod;
    fac = vector<long long>(n + 1, 0);
    finv = vector<long long>(n + 1, 0);
    inv = vector<long long>(n + 1, 0);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < n + 1; i++) {
      fac[i] = fac[i - 1] * i % fmod;
      inv[i] = mod - inv[mod % i] * (mod / i) % mod;
      finv[i] = finv[i - 1] * inv[i] % mod;
    }
  }
  ll nCr(ll n, ll r) {
    if (n < r) return 0;
    return fac[n] * finv[r] % fmod * finv[n - r] % fmod;
  }
  ll POW(ll a, ll b) {
    ll c = 1;
    while (b > 0) {
      if (b & 1) {
        c = a * c % fmod;
      }
      a = a * a % fmod;
      b >>= 1;
    }
    return c;
  }
  inline long long operator[](long long i) { return fac[i]; }
  ll DeBuG(ll n, ll r);
};
void DEBUG(vector<long long> a) {
  for (long long i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << endl;
}
void EMP(long long x) { cout << "!!!" << x << "!!!" << endl; }
ll GCD(ll a, ll b) {
  ll c;
  while (b != 0) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll LCM(ll a, ll b) { return (a / GCD(a, b)) * (b / GCD(a, b)) * GCD(a, b); }
ll POW(ll a, ll b) {
  ll c = 1;
  while (b > 0) {
    if (b & 1) {
      c = a * c % mod;
    }
    a = a * a % mod;
    b >>= 1;
  }
  return c;
}
ld POW(ld a, ll b) {
  ld c = 1;
  while (b > 0) {
    if (b & 1) {
      c = a * c;
    }
    a = a * a;
    b >>= 1;
  }
  return c;
}
void PRI(ll n) {
  bool a[n + 1];
  for (long long i = 0; i < n + 1; i++) {
    a[i] = 1;
  }
  for (long long i = 2; i < n + 1; i++) {
    if (a[i]) {
      prime.push_back(i);
      ll b = i;
      while (b <= n) {
        a[b] = 0;
        b += i;
      }
    }
  }
}
template <typename T>
T chmin(T& a, T b) {
  if (a > b) a = b;
  return a;
}
template <typename T>
T chmax(T& a, T b) {
  if (a < b) a = b;
  return b;
}
bool isSqrt(ll a) { return pow(sqrt(a), 2) == a ? 1 : 0; }
void YesNo(bool a) {
  if (a)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
}
void yesno(bool a) {
  if (a)
    cout << "yes";
  else
    cout << "no";
  cout << endl;
}
void YESNO(bool a) {
  if (a)
    cout << "YES";
  else
    cout << "NO";
  cout << endl;
}
double dis(long long x1, long long x2, long long y1, long long y2) {
  return sqrt((double)abs(x1 - x2) * (double)abs(x1 - x2) +
              (double)abs(y1 - y2) * (double)abs(y1 - y2));
}
long long ceili(long long x, long long y) {
  if (x % y == 0)
    return x / y;
  else
    return x / y + 1;
}
unsigned long long randxor() {
  static unsigned long long x = 123456789, y = 362436069, z = 521288629,
                            w = 88675123;
  unsigned long long t;
  t = (x ^ (x << 11));
  x = y;
  y = z;
  z = w;
  return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
uint64_t xor64(void) {
  static uint64_t x = 88172645463325252ULL;
  x = x ^ (x << 7);
  return x = x ^ (x >> 9);
}
void solve() {
  long long n;
  cin >> n;
  long long ans = 1;
  long long ac = 0, bc = 0;
  map<long long, long long> cnt;
  set<long long> cand;
  long long abz = 0;
  for (long long(i) = (0); (i) < (long long)(n); (i)++) {
    long long a, b;
    cin >> a >> b;
    if (a == b && a == 0) {
      continue;
    }
    if (a == 0) {
      ac++;
    } else if (b == 0) {
      bc++;
    } else {
      bool rev = (a < 0) ^ (b < 0);
      a = abs(a), b = abs(b);
      a %= mod, b %= mod;
      long long now = a * POW(b, mod - 2) % mod;
      if (rev) {
        cnt[-b * POW(a, mod - 2) % mod]++;
      } else {
        cnt[b * POW(a, mod - 2) % mod]++;
      }
      cand.insert((rev ? -1 : 1) * b * POW(a, mod - 2) % mod);
    }
  }
  ans = POW(2ll, ac) + POW(2ll, bc) - 1;
  set<long long> skip;
  for (auto&& elm : cand) {
    if (skip.find(elm) != skip.end()) continue;
    skip.insert(-POW(elm, mod - 2));
    ans *= (POW(2ll, cnt[elm]) + POW(2ll, cnt[-POW(elm, mod - 2)]) - 1);
    ans %= mod;
  }
  ans += mod - 1;
  cout << ans % mod << endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
