#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void reg(long long& a, long long& b) {
  long long g = gcd(abs(a), abs(b));
  a = a / g;
  b = b / g;
  if (a < 0 && b < 0) {
    a = -a;
    b = -b;
  } else if (a <= 0 && b > 0) {
    a = -a;
    b = -b;
  }
}
long long mpow(long long x, long long n) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) ans = ans * x % 1000000007;
    x = x * x % 1000000007;
    n = n >> 1;
  }
  return ans;
}
int main() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, pair<long long, long long>> m;
  for (long long i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    long long pos = true;
    reg(a, b);
    auto pa = abs(a);
    auto pb = abs(b);
    if ((a >= 0 && b >= 0) || (a <= 0 && b <= 0)) {
      m[make_pair(a, b)].first++;
    } else {
      m[make_pair(pb, pa)].second++;
    }
  }
  long long res = 1;
  for (auto p : m) {
    res = res * (mpow(2, p.second.first) + mpow(2, p.second.second) - 1);
    res %= 1000000007;
  }
  --res;
  res = (res + 1000000007) % 1000000007;
  cout << res << endl;
}
