Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactly x distinct squares in the table consisting of n rows and m columns. For example, in a 3 × 5 table there are 15 squares with side one, 8 squares with side two and 3 squares with side three. The total number of distinct squares in a 3 × 5 table is 15 + 8 + 3 = 26.


-----Input-----

The first line of the input contains a single integer x (1 ≤ x ≤ 10^18) — the number of squares inside the tables Spongebob is interested in.


-----Output-----

First print a single integer k — the number of tables with exactly x distinct squares inside.

Then print k pairs of integers describing the tables. Print the pairs in the order of increasing n, and in case of equality — in the order of increasing m.


-----Examples-----
Input
26

Output
6
1 26
2 9
3 5
5 3
9 2
26 1

Input
2

Output
2
1 2
2 1

Input
8

Output
4
1 8
2 3
3 2
8 1



-----Note-----

In a 1 × 2 table there are 2 1 × 1 squares. So, 2 distinct squares in total. [Image] 

In a 2 × 3 table there are 6 1 × 1 squares and 2 2 × 2 squares. That is equal to 8 squares in total. [Image]

Difficulty: interview

Starter code:

Solutions:
x = int(input())

def solve(x):
    count = 0
    lst = []
    x6 = x * 6
    for n in range(1, x + 1):
        t, r = divmod(x6, n*(n+1))
        if t < 2*n + 1:
            break
        if r:
            continue
        m, r = divmod(t + n - 1, 3)
        if r:
            continue
        count += 2
        lst.append((n, m))
    nn, mm = lst[-1]
    if nn == mm:
        count -= 1
    print(count)
    for n, m in lst:
        print(n, m)
    if nn != mm:
        print(mm, nn)
    lst.reverse()
    for n, m in lst[1:]:
        print(m, n)

solve(x)


n = int(input())
i = 0
s = 0
t = 0
x = 0
f = 0
res1 = []
res2 = []
while n >= 0:
	i = i + 1
	n = n - i * i
	if ( n < 0 ):
		break	
	t = t + i
	m =  n  //  t 
	if  ( m * t !=  n  ):
		continue
	else: 		
		res1.append(  i  )	
		res2.append(  m + i  )	
		x = x + 1
		if m == 0:
			f = 1

print( str(int(2 * x - f)) )
for i in range(x):
	print( str(int(res1[i])) + " " + str(int(res2[i])))
res1.reverse()
res2.reverse()
for i in range(x):
	if ( res1[i] != res2[i] ):
		print( str(int(res2[i])) + " " + str(int(res1[i])))


#from time import time

def solve( x ):

    res = [(1,x)]
    if x != 1:
        res.append( (x,1) )

    index , a , b = 1 , 1 , 0
    while True:
        b += a
        index += 1
        a += index

        if a*index-b > x:
            break

        if ( x + b ) % a == 0:
            m = ( x + b )// a
            res.append( ( index , m ) )
            if index != m:
                res.append( ( m , index ) )

    res.sort()
    print( len(res) )
    for ares in res:
        print( ares[0] , ares[1] )

def __starting_point():

    #t1 = time()
    x = int( input() )
    solve( x )
    #t2 = time()
    #print( "time :" , t2-t1 , "s" )

__starting_point()

n = int(input())
ans = []
for i in range(1, 1442250 + 10):
    t = i * (i + 1) // 2
    j, mod = divmod(n + (i - 1) * t // 3, t)
    if i > j:
        break
    if mod == 0:
        ans.append((i, j))
        if i != j: ans.append((j, i))
ans.sort()
print(len(ans))
for x, y in ans:
    print(x, y)


n = int(input())
ans = []
for i in range(1, 1442250 + 10):
    t = i * (i + 1) // 2
    j, mod = divmod(n + (i - 1) * t // 3, t)
    if i > j:
        break
    if mod == 0:
        ans.append((i, j))
        if i != j: ans.append((j, i))
ans.sort()
print(len(ans))
for x, y in ans:
    print(x, y)


n = int(input())
i,t,s = [0] * 3
r = []
while 1 > 0:
	i += 1
	n -= i * i
	if n < 0 : break
	t += i
	m = n  //  t 
	if  m * t !=  n :  continue
	r.append((i, m + i))
	if m > 0:
		r.append((m+i, i))	

print(len(r))
r.sort()
for m, n in r:
	print("%d %d" % (m , n))


n = int(input())
i,t,s = [0] * 3
r = []
while 1 > 0:
	i += 1
	n -= i * i
	if n < 0 : break
	t += i
	m = n  //  t 
	if  m * t !=  n :  continue
	r.append((i, m + i))
	if m > 0:
		r.append((m+i, i))	

print(len(r))
r.sort()
for m, n in r:
	print("%d %d" % (m , n))


x = int(input()) * 6
n, equ, ans = 0, False, []
while True:
	n += 1
	if n * (n + 1) * (2 * n - 1) > x:
		break
	if x % n != 0:
		continue
	if x % (n + 1) != 0:
		continue
	m = x // n // (n + 1) + n - 1
	if m % 3 != 0:
		continue
	m = m // 3
	if n <= m:
		ans.append([n, m])
		if n == m:
			equ = True

print(len(ans) * 2 - equ)
for p in ans:
	print("%d %d" % (p[0], p[1]))
if equ:
	ans.pop()
ans.reverse()
for p in ans:
	p.reverse();
	print("%d %d" % (p[0], p[1]))


x = int(input()) * 6
n, equ, ans = 0, False, []
while True:
	n += 1
	if n * (n + 1) * (2 * n - 1) > x:
		break
	if x % n != 0:
		continue
	if x % (n + 1) != 0:
		continue
	m = x // n // (n + 1) + n - 1
	if m % 3 != 0:
		continue
	m = m // 3
	if n <= m:
		ans.append((n, m))
		if n == m:
			equ = True

print(len(ans) * 2 - equ)
for p in ans:
	print("%d %d" % (p[0], p[1]))
if equ:
	ans.pop()
ans.reverse()
for p in ans:
	print("%d %d" % (p[1], p[0]))


x = int(input()) * 6
n, equ, ans = 0, False, []
while True:
	n += 1
	if n * (n + 1) * (2 * n - 1) > x:
		break
	if x % n != 0:
		continue
	if x % (n + 1) != 0:
		continue
	m = x // n // (n + 1) + n - 1
	if m % 3 != 0:
		continue
	m = m // 3
	if n <= m:
		ans.append((n, m))
		if n == m:
			equ = True
	else:
		break

print(len(ans) * 2 - equ)
for p in ans:
	print("%d %d" % (p[0], p[1]))
if equ:
	ans.pop()
ans.reverse()
for p in ans:
	print("%d %d" % (p[1], p[0]))


n=int(input())
i,t = 0,0
r=[]
while 1:
    i+=1
    n-=i*i
    if n<0:break
    t+=i
    m=n//t 
    r+=[(m+i,i),(i, m + i)][m==0:]*(m*t ==n)    
print(len(r))
for p in sorted(r): print("%d %d"%p)


#!/usr/bin/env python3
# 599D_squares.py - Codeforces.com/problemset/problem/599/D by Sergey 2015

import unittest
import sys

###############################################################################
# Squares Class (Main Program)
###############################################################################


class Squares:
    """ Squares representation """

    def __init__(self, test_inputs=None):
        """ Default constructor """

        it = iter(test_inputs.split("\n")) if test_inputs else None

        def uinput():
            return next(it) if it else sys.stdin.readline().rstrip()

        # Reading single elements
        [self.n] = list(map(int, uinput().split()))

    def calculate(self):
        """ Main calcualtion function of the class """

        result = []
        n = 1
        while n*n*(n-1)//6 < self.n:
            a = n * (n + 1) // 2
            b = n * (n - 1) * (n + 1) // 6
            m = self.n + b
            k = m // a
            if n <= k and  m % a == 0:
                result.append((n, k))
            n += 1
        result2 = list(result)
        result2 += [(b, a) for a, b in reversed(result) if a != b]
        s = str(len(result2)) + "\n"
        s += "\n".join([str(a) + " " + str(b) for a, b in result2])

        return s

###############################################################################
# Unit Tests
###############################################################################


class unitTests(unittest.TestCase):

    def test_single_test(self):
        """ Squares class testing """

        # Constructor test
        test = "26"
        d = Squares(test)
        self.assertEqual(d.n, 26)

        # Sample test
        self.assertEqual(
            Squares(test).calculate(), "6\n1 26\n2 9\n3 5\n5 3\n9 2\n26 1")

        # Sample test
        test = "0"
        self.assertEqual(Squares(test).calculate(), "0\n")

        # Sample test
        test = ""
        # self.assertEqual(Squares(test).calculate(), "0")

        # My tests
        test = ""
        # self.assertEqual(Squares(test).calculate(), "0")

        # Time limit test
        # self.time_limit_test(5000)

    def time_limit_test(self, nmax):
        """ Timelimit testing """
        import random
        import timeit

        # Random inputs
        test = str(nmax) + " " + str(nmax) + "\n"
        numnums = [str(i) + " " + str(i+1) for i in range(nmax)]
        test += "\n".join(numnums) + "\n"
        nums = [random.randint(1, 10000) for i in range(nmax)]
        test += " ".join(map(str, nums)) + "\n"

        # Run the test
        start = timeit.default_timer()
        d = Squares(test)
        calc = timeit.default_timer()
        d.calculate()
        stop = timeit.default_timer()
        print(("\nTimelimit Test: " +
              "{0:.3f}s (init {1:.3f}s calc {2:.3f}s)".
              format(stop-start, calc-start, stop-calc)))

def __starting_point():

    # Avoiding recursion limitaions
    sys.setrecursionlimit(100000)

    if sys.argv[-1] == "-ut":
        unittest.main(argv=[" "])

    # Print the result string
    sys.stdout.write(Squares().calculate())

__starting_point()

n=int(input())
i,t = 0,0
r=[]
while 1:
    i+=1
    n-=i*i
    if n<0:break
    t+=i
    m=n//t 
    r+=[(m+i,i),(i, m + i)][m==0:]*(m*t ==n)    
print(len(r))
for p in sorted(r): print("%d %d"%p)

"""
Codeforces Round #332 (Div. 2)

Problem 599 D. Spongebob and Squares

@author yamaton
@date 2015-11-20
"""

import itertools as it
import functools
import operator
import collections
import math
import sys


def solve(x):
    def find_p(n):
        return (6 * x // (n * (n + 1)) - 2 * n - 1) // 3
    def f(n, p):
        return n * (n + 1) * (2 * n + 3 * p + 1) - 6 * x

    result = []
    for n in it.count(1):
        p = find_p(n)
        if p < 0:
            break
        if f(n, p) == 0:
            result.append((n, n + p))
            if p > 0:
                result.append((n + p, n))
    result.sort()
    return result


# def p(*args, **kwargs):
#     return print(*args, file=sys.stderr, **kwargs)


def main():
    x = int(input())
    results = solve(x)
    print(len(results))
    for res in results:
        print(*res)



def __starting_point():
    main()

__starting_point()

n,i,t,r=int(input()),0,0,[]
while 1:
	i+=1
	n-=i*i
	if n<0:break
	t+=i
	m=n//t 
	r+=[(m+i,i),(i,m+i)][m==0:]*(m*t==n)
print(len(r))
for p in sorted(r):print("%d %d"%p)

n,i,t,r=int(input()),0,0,[]
while 1:
	i+=1
	n-=i*i
	if n<0:break
	t+=i
	m=n//t
	r+=[(m+i,i),(i,m+i)][m==0:]*(m*t==n)
print(len(r))
for p in sorted(r):print("%d %d"%p)

n,i,t,r=int(input()),0,0,[]
while n>=0:
	i+=1
	n-=i*i
	t+=i
	m=n//t
	r+=[(m+i,i),(i,m+i)][m==0:]*(m*t==n>=0)
for p in[(len(r),'')]+sorted(r):print("%d %s"%p)

n,i,t,r=int(input()),0,0,[]
while n>=0:
	i+=1
	n-=i*i
	t+=i
	m=n//t+i
	r+=[(m,i),(i,m)][m==i:]*(n%t==0<=n)
for p in[(len(r),'')]+sorted(r):print("%d %s"%p)

n,i,t,r=int(input()),0,0,[]
while n>=0:i+=1;n-=i*i;t+=i;m=n//t+i;r+=[(m,i),(i,m)][m==i:]*(n%t==0<=n)
for p in[(len(r),'')]+sorted(r):print("%d %s"%p)

__author__ = 'MoonBall'

import sys
# sys.stdin = open('data/D.in', 'r')
T = 1

def process():
    ans = []
    N = int(input())
    for i in range(1, 3000000):
        a = N + i * (i - 1) * (i + 1) // 6
        j, mod = divmod(a, i * (i + 1) // 2)
        if i > j: break
        if mod: continue
        ans.append((i, j))
        if i != j: ans.append((j, i))

    ans.sort()
    print(len(ans))
    for i, j in ans: print(i, j)





for _ in range(T):
    process()


__author__ = 'MoonBall'

import sys
# sys.stdin = open('data/D.in', 'r')
T = 1

def process():
    ans = []
    N = int(input())
    for i in range(1, N + 1):
        a = N + i * (i - 1) * (i + 1) // 6
        j, mod = divmod(a, i * (i + 1) // 2)
        if i > j: break
        if mod: continue
        ans.append((i, j))
        if i != j: ans.append((j, i))

    ans.sort()
    print(len(ans))
    for i, j in ans: print(i, j)





for _ in range(T):
    process()


from itertools import chain, combinations
from functools import reduce
from collections import defaultdict

def res(m,n):
    k = min(m,n)
    return (1+k)*(k+2*k**2-3*k*(m+n)+6*m*n) // 6

def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))

def prod(it):
    r = 1
    for elem in it:
        r *= elem
    return r

def factorGenerator(n):
    res = defaultdict(lambda: 0)
    for p in range(2,10**6+1):
        while n % p == 0:
            res[p] += 1
            n = n // p
    return res

def divisorGen(n):
    factors = list(factorGenerator(n).items())
    nfactors = len(factors)
    f = [0] * nfactors
    while True:
        yield reduce(lambda x, y: x*y, [factors[x][0]**f[x] for x in range(nfactors)], 1)
        i = 0
        while True:
            f[i] += 1
            if f[i] <= factors[i][1]:
                break
            f[i] = 0
            i += 1
            if i >= nfactors:
                return
def res2(x):
    r = []
    x6 = 6 * x
    divisors = set(divisorGen(x6))
    for m in divisors:
        a = x6 // m
        if a % (m+1) != 0:
            continue
        b = a // (m+1)
        c = b + m - 1
        if c % 3 != 0:
            continue
        n = c // 3
        if n < m:
            continue
        if res(m,n) != x:
            continue
        r.append((m,n))
    return r

x = int(input())
r = res2(x)
r = r + [(n,m) for m,n in r]
r = sorted(set(r))
print(len(r))
for (m,n) in r:
  print("%d %d"%(m, n))


s = int(input())
"""
nm + (n-1)(m-1) + ...
nm + nm -(n+m) + 1
6x
= 6mn*n - 3*(n-1)n(n+m) + (n-1)*n*(2n-1)
6x - n*(n+1)*(2n+1)+3*(n-1)n*n = (6n*n - 3*(n-1)*n)*m
"""
a, b = [], []
for n in range(1,1450000):
    u = 6*s - n*(n-1)*(n+n-1)+3*(n-1)*n*n
    v = 6*n*n - 3*(n-1)*n
    if u % v == 0:
        u //= v
        if n <= u:
            a += [(n, u)]
            if n < u:
                b += [(u, n)]
        else:
            break
print(len(a)+len(b))
for e in a:
    print(*e)
for e in reversed(b):
    print(*e)


x = int(input())
res = []
ok = -1
for i in range(1, 3000001):
    m = i
    tmp = (m-1)*(m+1)*m//6 + x
    if (tmp*2) % (m*(m+1)) == 0:
        n = int((tmp*2) // (m*(m+1)))
        if n > m:
            res.append([i, n])
        if n == m and ok == -1:
            ok = len(res)
            res.append([i, i])
d = 0 if ok == -1 else 1
print(len(res) * 2 - d)
for i in range(len(res)):
    print(str(res[i][0]) + " " + str(res[i][1]))
for i in range(len(res)):
    if len(res)-i-1 != ok:
        print(str(res[len(res)-i-1][1]) + " " + str(res[len(res)-i-1][0]))


import itertools
import math

x = int(input())
kmax = math.floor((3*x) ** (1/3))
ans = []
for i in range(1, kmax+1):
    if 6*x % (i*(i+1)) == 0:
        s = 6*x // (i*(i+1)) + i - 1
        if s % 3 == 0:
            ans.append((i,s//3))


res = 2*len(ans) - 1 if ans[-1][0] == ans[-1][1] else 2*len(ans)
print(res)
for pair in ans[:-1]:
    print(pair[0], pair[1])

if res%2 == 0: print(ans[-1][0], ans[-1][1])

for pair in reversed(ans):
    print(pair[1], pair[0])