#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int INF = 1e9;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool valid(int lx, int ux, int ly, int uy, int x, int y) {
  return lx <= x && x < ux && ly <= y && y < uy;
}
long long int power(long long int x, long long int p) {
  if (p == 0) return 1;
  long long int res = power(x * x % mod, p / 2);
  if (p % 2 == 1) res = res * x % mod;
  return res;
}
int main() {
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int> > p(n);
  for (int i = 0; i < (n); ++i) cin >> p[i].first >> p[i].second;
  map<pair<long long int, long long int>, pair<long long int, long long int> >
      mp;
  long long int zero = 0;
  for (int i = 0; i < (n); ++i) {
    if (p[i].first == 0 && p[i].second == 0) {
      zero += 1;
      continue;
    }
    long long int x;
    if (p[i].first == 0 || p[i].second == 0) {
      p[i].first = abs(p[i].first);
      p[i].second = abs(p[i].second);
      x = max(abs(p[i].first), abs(p[i].second));
    } else if (p[i].second > 0)
      x = gcd(p[i].first, p[i].second);
    else if (p[i].second < 0)
      x = gcd(-p[i].first, -p[i].second);
    p[i].first /= x;
    p[i].second /= x;
    if (p[i].first < 0) {
      p[i].first *= -1;
      p[i].second *= -1;
    }
    if (p[i].first == 0) p[i].second = 1;
    if (p[i].second == 0) p[i].first = 1;
    if (p[i] == pair<long long int, long long int>(1, 0))
      mp[pair<long long int, long long int>(1, 0)].first += 1;
    else if (p[i] == pair<long long int, long long int>(0, 1))
      mp[pair<long long int, long long int>(1, 0)].second += 1;
    else if (p[i].second < 0)
      mp[pair<long long int, long long int>(-p[i].second, p[i].first)].second +=
          1;
    else
      mp[p[i]].first += 1;
  }
  long long int ans = 1;
  for (auto x : mp) {
    pair<long long int, long long int> q = x.second;
    ans *= (power(2, q.first) + power(2, q.second) - 1) % mod;
    ans %= mod;
  }
  ans += zero + mod;
  ans %= mod;
  printf("%lld\n", ans - 1);
  return 0;
}
