#include <bits/stdc++.h>
using namespace std;
const long long int M = 1000000007;
long long int exp(int b, long long int e) {
  if (!e) return 1ll;
  long long int x = exp(b, e / 2);
  x *= x;
  x %= M;
  if (e & 1ll) {
    x *= b;
    x %= M;
  }
  return x;
}
long long int gcd(long long int a, long long int b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  map<pair<long long int, long long int>, int> bucket;
  set<pair<long long int, long long int> > procesado;
  long long int zeroes = 0;
  for (int i = 0; i < n; ++i) {
    long long int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zeroes++;
      continue;
    }
    long long int g = gcd(abs(a), abs(b));
    a /= g;
    b /= g;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    bucket[{a, b}]++;
  }
  long long int ans = 0;
  for (auto it : bucket) {
    long long int a, b, c;
    tie(a, b) = it.first;
    c = it.second;
    if (procesado.count({a, b}) > 0) continue;
    procesado.insert({a, b});
    long long int pa = b;
    long long int pb = -a;
    if (pa < 0) {
      pa *= -1;
      pb *= -1;
    }
    procesado.insert({pa, pb});
    long long int pc = 0;
    if (bucket.count({pa, pb})) {
      pc = bucket[{pa, pb}];
    }
    long long int curr = ans;
    long long int tmp = (exp(2, c) + exp(2, pc) - 2ll + M) % M;
    ans += (curr * tmp + tmp) % M;
    ans %= M;
  }
  if (zeroes > 0) {
    ans++;
    ans %= M;
  }
  cout << ans << "\n";
  return 0;
}
