#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
int main(int, char**) {
  int n;
  scanf("%d", &n);
  long long cnt0 = -1;
  map<pair<long long, long long>, pair<long long, long long>> cnt;
  long long pw[202020] = {1};
  for (int i = 1; i < 202020; i++) pw[i] = (pw[i - 1] * 2) % mod;
  for (int i = 0; i < n; i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    if (a == 0 && b == 0) {
      cnt0++;
      continue;
    }
    if (a < 0 || b < 0) {
      a = -a;
      b = -b;
    }
    long long g = gcd(abs(a), abs(b));
    a /= g;
    b /= g;
    if (b > 0)
      cnt[{a, b}].first++;
    else
      cnt[{-b, a}].second++;
  }
  long long ret = 1;
  for (auto& c : cnt) {
    ret = ret * (pw[c.second.first] + pw[c.second.second] - 1) % mod;
  }
  cout << (ret + cnt0) % mod << endl;
  return 0;
}
