#include <bits/stdc++.h>
using namespace std;
const long long p = 1000000007;
const int maxn = 200005;
int n;
map<pair<long long, long long>, long long> mp;
map<pair<long long, long long>, bool> vis;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1ll) ans = (ans * a) % p;
    a = (a * a) % p;
    b >>= 1ll;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  long long zero_cnt = 0;
  for (register int i = (0); i < (n); ++i) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    if (!a && !b) {
      zero_cnt++;
      continue;
    }
    long long c = gcd(a, b);
    a /= c, b /= c;
    if (b < 0) a = -a, b = -b;
    mp[pair<long long, long long>{a, b}]++;
  }
  map<pair<long long, long long>, long long>::iterator it;
  long long ans = 1;
  for (it = mp.begin(); it != mp.end(); ++it) {
    pair<long long, long long> pp = it->first;
    pp = pair<long long, long long>{-pp.second, pp.first};
    if (pp.second < 0) pp = pair<long long, long long>{-pp.first, -pp.second};
    if (vis[pp] || vis[it->first]) continue;
    long long num1 = mp[it->first], num2 = mp[pp];
    long long add = (qpow(2, num1) + qpow(2, num2) - 1ll) % p;
    ans = (ans * add) % p;
    vis[pp] = vis[it->first] = true;
  }
  ans += zero_cnt - 1ll;
  ans %= p;
  printf("%lld\n", ans);
}
