import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) divisors.append(n // i) return divisors n = int(readline()) k = int(readline()) k = make_divisors(k) ans = 0 for x, y in zip(k[::2], k[1::2]): xx = x - 1 if n >= x else 2 * n + 1 - x yy = y - 1 if n >= y else 2 * n + 1 - y xy = xx * yy if xy >= 0: if x != y: xy *= 2 ans += xy print(ans)