#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
vector<long long> dx = {1, -1, 0, 0};
vector<long long> dy = {0, 0, 1, -1};
vector<vector<long long>> g;
long long gcd(const long long& a, const long long& b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long c = 0;
  map<pair<long long, long long>, long long> m;
  set<pair<long long, long long>> used;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    long long gc = gcd(abs(a), abs(b));
    a /= gc;
    b /= gc;
    if (b < 0) {
      a *= -1ll;
      b *= -1ll;
    }
    if (a == 0 && b == 0) {
      c++;
      continue;
    }
    if (b == 0) {
      a = 1;
      b = 0;
    }
    if (a == 0) {
      a = 0;
      b = 1;
    }
    m[pair<long long, long long>(a, b)]++;
  }
  vector<long long> cc(n + 1);
  cc[0] = 1;
  for (int i = 1; i <= n; ++i) {
    cc[i] = 2ll * cc[i - 1] + 1ll;
    cc[i] %= mod;
  }
  long long ret = 1;
  for (auto itr = m.begin(); itr != m.end(); ++itr) {
    pair<long long, long long> cur = itr->first;
    if (itr->second == 0 || used.count(cur) != 0) {
      continue;
    }
    long long tmp = 1ll + cc[itr->second - 1ll];
    used.insert(cur);
    pair<long long, long long> check =
        pair<long long, long long>(-cur.second, cur.first);
    if (cur.first < 0) {
      check = pair<long long, long long>(cur.second, -cur.first);
    }
    if (m[check] != 0) {
      tmp += cc[m[check] - 1ll];
      used.insert(check);
    }
    ret *= tmp;
    ret %= mod;
  }
  ret += c;
  ret %= mod;
  ret -= 1ll;
  if (ret < 0) {
    ret += mod;
  }
  cout << ret << endl;
  return 0;
}
