#include<stdio.h>
#include<stdlib.h>
long gcd(long a,long b){return b?gcd(b,a%b):a;}
struct X{long A,B;int f}A[2<<17];

cmp(a,b)struct X*a,*b;{
    long dA=a->A-b->A,dB=a->B-b->B;
    return dA?dA<0?-1:1:dB?dB<0?-1:1:0;
};
const long mod=1e9+7;
long O=mod-1;
int main()
{
    int N;long a,b;int sz=0;
    scanf("%d",&N);
    ////输入并实现a，b的标准化
    for(int i=0;i<N;i++){
        scanf("%ld %ld",&a,&b);
            int f=0;
        if(!a&&!b) O++;
        else{
              a=a/gcd(a,b);b=b/gcd(a,b);
            if(a<0){
                a=-a;
                b=-b;
            }
            if(a==0){
                a=1;
                b=0;
                f=1;
            }
            else if(b<0){
                int t;
                t=a;
                a=-b;
                b=t;
            }
            A[sz].A=a;
            A[sz].B=b;
            A[sz].f=f;
            sz++;
        }
    }
    //实现排序
    qsort(A,sz,sizeof(struct X),cmp);
    //实现计算；
    long ans=1;
    for(int i=0;i<sz;){
        int c[2]={1,1};
        int j=i;
        while(i<sz&&A[i].A==A[j].A&&A[i].B==A[j].B){
            c[A[i].f]=c[A[i].f]*2%mod;
            i++;
        }
        ans*=(c[0]+c[1]-1)%mod;
    }
    printf("%d",(ans+O)%mod);
}