using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Abc168E
    {
        static long mod = 1000000007;

        public static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var count = new Dictionary<(long, long), int[]>();
            var zeroN = 0;
            for (int i = 0; i < n; i++)
            {
                var ab = Console.ReadLine().Split(' ').Select(j => long.Parse(j)).ToArray();

                var r = Gcd(Math.Abs(ab[0]), Math.Abs(ab[1]));
                var a = ab[0] / r;
                var b = ab[1] / r;

                if (a == 0 && b == 0)
                {
                    zeroN++;
                    continue;
                }
                else if (a == 0)
                    b = 1;
                else if (b == 0)
                    a = -1;

                if (b < 0)
                {
                    a = -a;
                    b = -b;
                }

                bool reverse = a < 0;
                (long, long) key = reverse ? (b, -a) : (a, b);

                if (count.TryGetValue(key, out var v))
                    v[reverse ? 1 : 0]++;
                else
                    count.Add(key, reverse ? new[] { 0, 1 } : new[] { 1, 0 });
            }

            long ans = 1;
            foreach (var item in count.Values)
                ans = (ModPower(2, item[0]) + ModPower(2, item[1]) - 1) % mod * ans % mod;
            Console.WriteLine((ans + zeroN - 1) % mod);
        }

        static long Gcd(long a, long b)
        {
            if (a < b)
                return Gcd(b, a);
            while (b > 0)
            {
                var r = a % b;
                a = b;
                b = r;
            }
            return a;
        }

        static long ModPower(long a, long n)
        {
            long ret = 1;
            while (n > 0)
            {
                if (n % 2 == 1)
                    ret = ret * a % mod;
                a = a * a % mod;
                n /= 2;
            }
            return ret;
        }
    }
}
