#include <bits/stdc++.h>
using namespace std;
const int mod = 1e+9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long po(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  y = y % (mod - 1);
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return (res) % mod;
}
void solve() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> sar;
  map<pair<long long, long long>, int> visit;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      if (sar.find({0, 0}) == sar.end())
        sar[{0, 0}] = 1;
      else
        sar[{0, 0}]++;
    } else if (a == 0) {
      if (sar.find({0, 1}) == sar.end())
        sar[{0, 1}] = 1;
      else
        sar[{0, 1}]++;
    } else if (b == 0) {
      if (sar.find({1, 0}) == sar.end())
        sar[{1, 0}] = 1;
      else
        sar[{1, 0}]++;
    } else if (a < 0 && b > 0) {
      a = -a;
      long long gec = gcd(a, b);
      a = -a / gec;
      b = b / gec;
      if (sar.find({a, b}) == sar.end())
        sar[{a, b}] = 1;
      else
        sar[{a, b}]++;
    } else if (a < 0 && b > 0) {
      b = -b;
      long long gec = gcd(a, b);
      a = -a / gec;
      b = b / gec;
      if (sar.find({a, b}) == sar.end())
        sar[{a, b}] = 1;
      else
        sar[{a, b}]++;
    } else {
      if (a < 0) {
        a = -a;
        b = -b;
      }
      long long gec = gcd(a, b);
      a = a / gec;
      b = b / gec;
      if (sar.find({a, b}) == sar.end())
        sar[{a, b}] = 1;
      else
        sar[{a, b}]++;
    }
    visit[{a, b}] = 0;
  }
  long long tot = 1;
  for (auto x : sar) {
    if (visit[x.first] == 1 || ((x.first).first == 0 && (x.first).second == 0))
      continue;
    visit[x.first] = 1;
    long long sum = po(2, x.second);
    pair<long long, long long> newr = {(x.first).second, -(x.first).first};
    if (sar.find(newr) != sar.end()) {
      sum += po(2, sar[newr]) - 1;
      visit[newr] = 1;
    }
    sum = (sum) % mod;
    tot = (tot * sum) % mod;
  }
  if (sar.find({0, 0}) != sar.end()) tot = (tot + sar[{0, 0}]) % mod;
  cout << (tot - 1) % mod << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
