#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, pair<int, int> > mp;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long quick_pow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return ret % 1000000007;
}
int main() {
  int n, i;
  long long a, b, d, zero = 0, sum = 1;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lld%lld", &a, &b);
    if (!a && !b) {
      zero++;
      continue;
    }
    d = gcd(a, b);
    a /= d, b /= d;
    if (b < 0) a = -a, b = -b;
    if (a < 0)
      mp[make_pair(b, -a)].second++;
    else
      mp[make_pair(a, b)].first++;
  }
  for (map<pair<long long, long long>, pair<int, int> >::iterator it =
           mp.begin();
       it != mp.end(); it++)
    sum = (quick_pow((long long)2, (long long)it->second.first) - 1 +
           quick_pow((long long)2, (long long)it->second.second) - 1 + 1) %
          1000000007 * sum % 1000000007;
  sum = (sum + zero - 1) % 1000000007;
  sum = (sum % 1000000007 + 1000000007) % 1000000007;
  printf("%lld\n", sum);
  return 0;
}
