#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long exp(long long a, long long b) {
  if (b < 0) return 0;
  long long r = 1;
  while (b) {
    if (b & 1) r = r * a % 1000000007, r %= 1000000007;
    a = a * a % 1000000007;
    b /= 2;
  }
  return r;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long first[3011], IV[3011];
map<pair<long long, long long>, long long> mp;
int solve() {
  long long n, i, j, k, m, x, y, z;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> x >> y;
    if (x == 0 && y == 0) {
      continue;
    } else if (x == 0) {
      mp[{0, 1}]++;
    } else if (y == 0) {
      mp[{1, 0}]++;
    } else {
      long long g = gcd(abs(x), abs(y));
      x /= g;
      y /= g;
      long long sign = -1;
      if ((x > 0 && y > 0) || (x < 0 && y < 0)) sign = 1;
      mp[{abs(x), sign * abs(y)}]++;
    }
  }
  set<pair<long long, long long> > done;
  long long p = 1ll;
  if (mp.size() == 0) {
    cout << 0 << "\n";
    return 0;
    ;
  }
  for (auto _x : mp) {
    long long cnt = _x.second;
    long long a = _x.first.first, b = _x.first.second;
    long long ao, bo;
    if (a == 0) {
      ao = 1, bo = 0;
    } else if (b == 0) {
      ao = 0, bo = 1;
    } else {
      ao = abs(b), bo = a;
      if (b > 0) bo = -bo;
    }
    if (done.find({ao, bo}) != done.end()) continue;
    done.insert({a, b});
    done.insert({ao, bo});
    p = p * (exp(2, mp[{a, b}]) + exp(2, mp[{ao, bo}]) - 1);
    p %= 1000000007;
  }
  p = (p - 1 + 1000000007) % 1000000007;
  cout << p << "\n";
  return 0;
  ;
}
void prec() {
  first[0] = IV[0] = 1;
  for (int i = 1; i < 3011; ++i) {
    first[i] = first[i - 1] * i % 1000000007, first[i] %= 1000000007;
    IV[i] = IV[i - 1] * exp(i, 1000000007 - 2) % 1000000007,
    IV[i] %= 1000000007;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  ;
  while (t--) {
    solve();
  }
  return 0;
  ;
}
