#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long mypow(long long a, long long b) {
  a %= 1000000007;
  long long res = 1;
  while (b > 0) {
    if (b % 2 == 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b /= 2;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  multiset<pair<long long, long long>> dir1;
  multiset<pair<long long, long long>> dir2;
  vector<int> num;
  int numzero = 0;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      numzero++;
      continue;
    } else if (b == 0) {
      dir1.insert(make_pair(1, 0));
      continue;
    } else if (a == 0) {
      dir2.insert(make_pair(1, 0));
      continue;
    }
    long long g = gcd(abs(a), abs(b));
    a = a / g;
    b = b / g;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (b >= 0)
      dir1.insert(make_pair(a, b));
    else
      dir2.insert(make_pair(-b, a));
  }
  long long res = 1;
  multiset<pair<long long, long long>>::iterator it1 = dir1.begin();
  multiset<pair<long long, long long>>::iterator it2 = dir2.begin();
  while (it1 != dir1.end() || it2 != dir2.end()) {
    long long count = 0;
    if (it1 == dir1.end()) {
      count = mypow(2, dir2.count(*it2)) % 1000000007;
      it2 = dir2.upper_bound(*it2);
    } else if (it2 == dir2.end()) {
      count = mypow(2, dir1.count(*it1)) % 1000000007;
      it1 = dir1.upper_bound(*it1);
    } else if (*it2 < *it1) {
      count = mypow(2, dir2.count(*it2)) % 1000000007;
      it2 = dir2.upper_bound(*it2);
    } else if (*it1 < *it2) {
      count = mypow(2, dir1.count(*it1)) % 1000000007;
      it1 = dir1.upper_bound(*it1);
    } else {
      count = (mypow(2, dir2.count(*it2)) - 1) % 1000000007;
      count = (count + mypow(2, dir1.count(*it1)) - 1) % 1000000007;
      count = (count + 1) % 1000000007;
      it1 = dir1.upper_bound(*it1);
      it2 = dir2.upper_bound(*it2);
    }
    res = res * count % 1000000007;
  }
  if (numzero == 0)
    cout << (res - 1) % 1000000007 << endl;
  else {
    long long reszero = numzero;
    res = (res - 1 + reszero) % 1000000007;
    cout << res << endl;
  }
}
