#include<bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
struct modint {
  long long val;
  modint(long long val=0) : val((val % MOD + MOD) % MOD){}
  modint operator-() const { return modint(-val); }
  modint& operator+=(const modint a) { if ((val += a.val)     >= MOD) val -= MOD; return *this; }
  modint& operator-=(const modint a) { if ((val += MOD-a.val) >= MOD) val -= MOD; return *this; }
  modint& operator*=(const modint a) { (val *= a.val) %= MOD; return *this; }
  modint operator+(const modint a) const { return (modint)*this += a; }
  modint operator-(const modint a) const { return (modint)*this -= a; }
  modint operator*(const modint a) const { return (modint)*this *= a; }
  modint pow(long long n) const { modint r(1), m(val); while (n > 0) { if (n & 1) {r *= m;} m *= m; n >>= 1; } return r; }
  modint inv() const { return pow(MOD-2); }
  modint& operator/=(const modint a) { return (*this) *= a.inv(); }
  modint operator/(const modint a) const { return (modint)*this /= a; }
  bool operator==(const modint &p) const { return val == p.val; }
  bool operator!=(const modint &p) const { return val != p.val; }
  friend ostream &operator<<(ostream &os, const modint &p) { return os << p.val; }
  friend istream &operator>>(istream &is, modint &a) { long long t; is >> t; a = modint(t); return (is); }
};

int N;
long long A[200000], B[200000];

signed main() {
  cin >> N;
  for(int i=0; i<N; i++) cin >> A[i] >> B[i];

  int zero = 0;
  map<pair<long long, long long>, pair<int,int>> mp;
  for(int i=0; i<N; i++) {
    long long a = A[i], b = B[i];
    if(a==0 && b==0) {zero++; continue;}
    long long g = gcd(a,b);
    a /= g;
    b /= g;
    if(a < 0) { a=-a; b=-b; }
    if(b > 0) mp[make_pair(a,b)].first++;
    else      mp[make_pair(-b,a)].second++;
  }

  modint ans = 1;
  for(auto i : mp) {
    ans *= (modint(2).pow(i.second.first) - 1) + (modint(2).pow(i.second.second) - 1) + 1;
  }
  ans += zero;
  ans -= 1;

  cout << ans << endl;
}
