#include <bits/stdc++.h>
using namespace std;
long long int dmod(long long int x) { return ((x + 1000000007) % 1000000007); }
long long int power(long long int x, long long int y) {
  long long int ans = 1;
  while (y > 0) {
    if (y & 1) ans = dmod(ans * x);
    y /= 2;
    x = dmod(x * x);
  }
  return ans;
}
long long int gcd(long long int x, long long int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  map<pair<long long int, long long int>, int> mp;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    long long int x = abs(a);
    long long int y = abs(b);
    long long int g = gcd(max(x, y), min(x, y));
    a /= g;
    b /= g;
    mp[{a, b}]++;
  }
  long long int ans = 1;
  for (auto it : mp) {
    long long int x, y;
    x = it.first.first;
    y = it.first.second;
    int team1 = mp[{x, y}] + mp[{-1 * x, -1 * y}];
    int team2 = mp[{-1 * y, x}] + mp[{y, -1 * x}];
    long long int p = power(2, team1);
    if (team1 == 0) p = 0;
    long long int q = power(2, team2);
    if (team2 == 0) q = 0;
    long long int k = p + q;
    if (p == 0 && q == 0)
      k = 1;
    else if (p == 0 || q == 0)
      k = p + q;
    else
      k -= 1;
    ans = dmod(ans * dmod(k));
    mp[{x, y}] = 0;
    mp[{-1 * x, -1 * y}] = 0;
    mp[{-1 * y, x}] = 0;
    mp[{y, -1 * x}] = 0;
  }
  cout << ans - 1;
  return 0;
}
