n,m = input().split()
n,m = int(n),int(m)
q = n-m+1
p = n-m

h = q*p
Max = h>>1
a = int(n/m)
sum1 = (a*(a-1))/2*(m-n%m)
sum2 = (a+1)*(a)/2*(n%m)
Min = int(sum1+sum2)
print(Min, Max)

n,m=map(int,input().split())
q=n//m
rem=n%m
ans=int((((n-m+1))*(n-m)))
kmax=(ans//2)
if q>1:
    kmin=int(rem*(((q+1)*(q))/2)+(m-rem)*(((q)*(q-1))/2))
else:
    kmin=rem
print(kmin,kmax)

from decimal import *

def pair(n):
    return Decimal(n / 2) * (n - 1)

nm = [int(i) for i in input().split()]
print(int(((nm[1] - nm[0] % nm[1]) * pair(nm[0] // nm[1])) + ((nm[0] % nm[1]) * (pair(nm[0] // nm[1] + 1)))),
      int(pair(nm[0] - (nm[1] - 1))))

def sumTillN(N):
    return (N*(N-1))>>1
N,M = map(int,input().split())
Max = sumTillN(N - (M-1))
Number = int(N//M)
Some = N%M
X = Some * sumTillN(Number+1)
Y = (M - Some) * sumTillN(Number)
Min = X+Y
print(Min,Max)

(n,m)=map(int,raw_input().split())

""""
Finding Minimum
n=total people, m = teams
Divide (n-n%m) players equally into each team.
n%m players left will go to teams
Therefore, m-n%m teams of n/m players and n%m teams of n/m+1 players
Teams of m//n people : m-1
	Connections = (m-1) * combi(m//n,2)
Teams of m//n + m % n people : 1
	Connections = 1 * combi(m//n+m%n,2)
"""

def combi(n):
	if n==1:
		return 0
	else:
		return n*(n-1)/2

min_pairs = (m-n%m) * combi(n//m) + n%m * combi(n//m+1)
#print m-1,'teams of',n//m,'players and',1,'team of',n//m+n%m
"""
Finding Maximum
n=total people, m = teams
Single teams = m-1
Members in last team = n-(m-1)
"""

max_pairs = 1 * combi(n-(m-1))

print min_pairs,max_pairs

###Codeforces problem 478B###

n, m = map(int, raw_input().split())

kmax = (n - m + 1) * (n - m) / 2
x = n / m
y = n % m
kmin = y * (x + 1) * x / 2 + (m - y) * x * (x - 1) / 2
if x == 1:
    pass
print kmin, kmax

def nCr(n):
    return n*(n-1)/2

def main():
    n,m = map(int,raw_input().split());
    val,min_pairs,max_pairs,comb = 0,0,0,0

    each = n/m
    r = n%m

    comb = nCr(each)

    if((each*m) != n):
        min_pairs = nCr(each+1)*r + comb*(m-r)

    else:
        min_pairs = comb*m

    temp = n-(m-1)
    if(temp != 1):
        max_pairs = nCr(temp);
    else:
        max_pairs = 0

    print(min_pairs),
    print(max_pairs)

main()

def nCr(n):
    return (n-1)*n//2

n, m = list(map(int, input().split()))
a, b = divmod(n,m)
res_min = b*nCr(a+1)
if a >= 2:
    res_min += (m-b)*nCr(a)
res_max = nCr(n - (m-1))
print(res_min, res_max)

import math

def ncr(a):
    return a * (a-1) / 2

n, m = [int(x) for x in raw_input().split()]

mn = 0
if n > m:
    mn = ncr(n/m) * m + (n%m)*(n/m)

mx = 0
if n > 1:
    mx = ncr(n+1-m)

print mn, mx

def ncr(n1):
    f=(n1*(n1-1))//2
    return f

n,m=input().split(" ")
n=int(n)
m=int(m)
c=n-m

Max=ncr(c+1)
s=n//m
s1=n%m
d=m*s*(s-1)//2
d1=s1*(s)
Sum=d+d1

print(Sum,Max)

n,m = map(int,raw_input().split())
result = []
max_friends= (n - m + 1) * (n - m) / 2

min_friends, avg_in_team = 0, n / m
min_friends += ((avg_in_team + 1) * avg_in_team / 2) * (n % m)
min_friends += avg_in_team * (avg_in_team - 1) / 2 * (m - (n % m))

result.append(min_friends)
result.append(max_friends)

print " ".join(map(str,result))

#########			##	##     ##    	  ####  #####  ##     #  ##     #		##
	#			   # #	# #   # #		 #	  #	#	#  # #    #  # #    #	   # #
	#			  #  #	#  ###  #	    #		#	#  #  #   #  #  #   #	  #  #
	#			 #####	#	#	#	   #    ###	#	#  #   #  #  #   #  #    #####
	#			#    #	#		#	   #    # #	#	#  #	# #  #	  # #   #    #
######### 	   #     # 	#		#		##### #	#####  #	 ##  #	   ##  #     #

"""

PPPPPPP       RRRRRRR		    OOOO	  VV        VV    EEEEEEEEEE
PPPPPPPP      RRRRRRRR         OOOOOO     VV       VV	  EE
PPPPPPPPP     RRRRRRRRR       OOOOOOOO    VV      VV	  EE
PPPPPPPP      RRRRRRRR        OOOOOOOO    VV     VV    	  EEEEEE
PPPPPPP       RRRRRRR         OOOOOOOO    VV    VV        EEEEEEE
PP  		  RRRR			  OOOOOOOO    VV   VV         EEEEEE
PP			  RR  RR          OOOOOOOO    VV  VV          EE
PP			  RR    RR         OOOOOO     VV VV           EE
PP			  RR      RR        OOOO      VVVV            EEEEEEEEEE

"""

"""
 Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away.
"""
import sys
input = sys.stdin.readline
# from bisect import bisect_left as lower_bound;
# from bisect import bisect_right as upper_bound;
# from math import ceil, factorial;

def ceil(x):
    if x != int(x):
        x = int(x) + 1
    return x

def factorial(x, m):
	val = 1
	while x>0:
		val = (val * x) % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

# swap_array function
def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp;

## gcd function
def gcd(a,b):
    if b == 0:
        return a;
    return gcd(b, a % b);

## nCr function efficient using Binomial Cofficient
def nCr(n, k):
	if k > n:
		return 0
	if(k > n - k):
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

## upper bound function code -- such that e in a[:i] e < x;
def upper_bound(a, x, lo=0, hi = None):
    if hi == None:
        hi = len(a);
    while lo < hi:
        mid = (lo+hi)//2;
        if a[mid] < x:
            lo = mid+1;
        else:
            hi = mid;
    return lo;

## prime factorization
def primefs(n):
    ## if n == 1    ## calculating primes
    primes = {}
    while(n%2 == 0 and n > 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0 and n > 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    ## prime factoriazation of n is stored in dictionary
    ## primes and can be accesed. O(sqrt n)
    return primes

## MODULAR EXPONENTIATION FUNCTION
def power(x, y, p):
    res = 1
    x = x % p
    if (x == 0) :
        return 0
    while (y > 0) :
        if ((y & 1) == 1) :
            res = (res * x) % p
        y = y >> 1
        x = (x * x) % p
    return res

## DISJOINT SET UNINON FUNCTIONS
def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b;

# find function with path compression included (recursive)
# def find(x, link):
#     if link[x] == x:
#         return x
#     link[x] = find(link[x], link);
#     return link[x];

# find function with path compression (ITERATIVE)
def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];

    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;

# the union function which makes union(x,y)
# of two nodes x and y
def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x

## returns an array of boolean if primes or not USING SIEVE OF ERATOSTHANES
def sieve(n):
    prime = [True for i in range(n+1)]
    prime[0], prime[1] = False, False
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime

#### PRIME FACTORIZATION IN O(log n) using Sieve ####
MAXN = int(1e5 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    ## function for storing smallest prime factors (spf) in the array

################## un-comment below 2 lines when using factorization #################
spf = [0 for i in range(MAXN)]
# spf_sieve();
def factoriazation(x):
    res = []
    for i in range(2, int(x ** 0.5) + 1):
    	while x % i == 0:
    		res.append(i)
    		x //= i
    if x != 1:
   		res.append(x)
    return res
    ## this function is useful for multiple queries only, o/w use
    ## primefs function above. complexity O(log n)

## taking integer array input
def int_array():
    return list(map(int, input().strip().split()));

def float_array():
    return list(map(float, input().strip().split()));

## taking string array input
def str_array():
    return input().strip().split();

#defining a couple constants
MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');

################### ---------------- TEMPLATE ENDS HERE ---------------- ###################

from itertools import permutations
import math

from bisect import bisect_left

def solve():
	n, m = map(int, input().split())
	r = n % m
	q = n // m
	if m > 1:
		# print(q, r, nCr(1, 2))
		print(((q * (q - 1)) // 2) * (m - r) + (((q + 1) * q) // 2) * r, (n - m + 1) * (n - m) // 2)
	else:
		print(nCr(q, 2), nCr(q, 2))

if __name__ == '__main__':
	for _ in range(1):
		solve()
	# fin_time = datetime.now()
# 	print("Execution time (for loop): ", (fin_time-init_time))

n, m = map(int, raw_input().split())
temp = n/m
print (temp * (temp -1))/2*m + (0 if n%m == 0 else temp*(n%m)),
temp = n - m + 1
print (temp * (temp -1))/2

def see(a,b) :
    if a < b :
        return 0
    elif a == b :
        return 1
    else :
        return a * (a-1) / 2
n,m = map(int,raw_input().split())
rem = n % m
a = n / m
kmax = see(n-m+1,2)
kmin = rem * see(a+1,2) + (m-rem) * see(a,2)
print str(kmin) + ' ' + str(kmax)

def friends_in_team(amount):
    if amount <= 1:
        return 0
    return (amount * (amount - 1)) // 2

n, m = (int(x) for x in input().split())
a = friends_in_team(n // m) * (m - n % m)
a += friends_in_team(n // m + 1) * (n % m)
b = friends_in_team(n - m + 1)
print('{} {}'.format(min(a, b), max(a, b)))

n,m=map(int,raw_input().split())
a=n/m
print m*a*(a-1)/2+a*(n%m),(n-m)*(n-m+1)/2

def fact(x):
    return ((x+1)*x)//2
n, m = map(int, input().split())
kmax = fact(n-m)
if (m == 1):
    kmin = kmax
elif (n%m != 0):
    kmin = (m-n%m)*fact(n//m-1) + (n%m)*fact(n//m)
else:
    kmin = m*fact(n//m-1)
print(kmin, kmax)

def C(n):
    if(n>=1):
        return (n*(n-1))/2
    else:
        return 0
n1,m1=raw_input().split()
n=int(n1);m=int(m1)
a=C(n-m+1)
q=n/m;r=n%m
b=(r*C(q+1))+(m-r)*C(q)
print b,a

def nCr2(n):
    if n < 2: return 0
    return n * (n-1) / 2
def inp(): return map(long, raw_input().split())
n,m = inp()
mx = long(nCr2(n-m+1))
mn = long((n%m) * nCr2(n//m + 1) + (m-n%m) * nCr2(n//m))
print mn,mx

if __name__ == '__main__':
	n,m = map(int,raw_input().split())
	eq = n/m
	rem = n%m
	kmin=(((eq+1)*eq)/2)*rem
	kmin+=(((eq-1)*eq)/2)*(m-rem)
	t1 = n-m+1
	kmax = t1*(t1-1)
	kmax /= 2
	print kmin,kmax

def comb(h):
	if h%2==0:
		k=(int((h)/2))*(h-1)
	else:
		k=(int((h-1)/2))*(h)
	k=int(k)
	return k
g=input()
n,m=[int(x) for x in g.split()]
kmax=comb(n-m+1)
if n-m<m:
	kmin=n-m
else:
	mini=int(n/m)
	t=n-(mini*m)
	if t==0:
		kmin=m*comb(mini)
	else:
		rem=m-t
		kmin=t*comb(mini+1)+rem*comb(mini)
print(kmin,kmax)

n,m=map(int,input().split())
maxi=(n-m+1)*(n-m)//2
k=n//m
mini=k*(k-1)//2
mini*=m
mini+=k*(n%m)
print(mini,maxi)

def comb(a):
    return (a*(a-1))/2
p,t=raw_input().split()
p=int(p)
t=int(t)
mx=comb(p-t+1)
if(p%t==0):
    mn=t*comb(p/t);
else:
    x=p%t;
    i=p/t;
    mn=x*comb(i+1)+(t-x)*comb(i);
print mn,mx

import math
n,m=map(int,input().strip().split(' '))
f=lambda x: ((x-1)*x)>>1
amax=f(n-m+1)
amin=f(math.ceil(n/m))*(n%m) + f(math.trunc(n/m))*(m-n%m)
print(amin,amax)

def sumupto(z):
	return int(z*(z-1)/2)

n,m=map(int,input().split())
print(m*sumupto(n//m)+n%m*(n//m),(n-m+1)*(n-m)//2)

def xc2(x):
    t=x*(x-1)/2
    return t
n,m=raw_input().split()
n=int(n)
m=int(m)
q=n/m
r=n%m
max=xc2(n-m+1)
min=(m-r)*xc2(q)+r*xc2(q+1)
print min,max

import math

def get_pairs(n):
    return n*(n-1)/2

def get_small(n_m):
    n = n_m[0]
    m = n_m[1]
    if n % m != 0:
        at_least = n/m
        remain = n%m
        count_fewer = (m-remain)*get_pairs(at_least)
        count_more = remain*get_pairs(at_least+1)
        return count_fewer + count_more
    else:
        each_bucket = n / m
        return m*(each_bucket*(each_bucket-1)/2)

def get_big(n_m):
    n = n_m[0]
    m = n_m[1]
    largest_team = n - (m-1)
    return largest_team*(largest_team-1)/2

n_m = map(int, raw_input().split())
smallest = get_small(n_m)
biggest = get_big(n_m)
print "%s %s" % (int(smallest), int(biggest))

n,m = map(int, raw_input().split(" "))

def nC2(n):
    return (n*(n-1))/2

maX = n - m + 1
kmax = 0

if maX > 1:
    kmax = nC2(maX)

kmin = 0

if n%m == 0:
    kmin = m*nC2((n/m))
else:
    if(n/m > 1):
        kmin = (m-(n%m))*nC2(n/m)
    kmin += (n%m)*(nC2((n/m)+1))

print kmin, kmax

import math
parter,group = [int(x) for x in input().split()]
ans = 0
m2 = parter - (group-1)
m_min = parter//group
gr_max = parter%group
m_max = m_min+1
gr_min = group-gr_max

ans = int(m_min*(m_min-1)*gr_min//2+m_max*(m_max-1)*gr_max//2)

print(str(ans)+' '+str(int(m2*(m2-1)//2)))

#!/usr/bin/env python3

from math import factorial
from math import ceil
from functools import lru_cache

def _kmin(n, m):
    if m == 1: return comb(n, 2)
    c = ceil(n / m)
    return comb(c, 2) + _kmin(n - c, m - 1)

@lru_cache(maxsize=128)
def semifact(a, b):
    if (a == b): return 1
    else: return a * semifact(a - 1, b)

@lru_cache(maxsize=128)
def comb(a, b):
    if b > a: return 0
    return semifact(a, max(b, (a - b))) // factorial(min(b, (a - b)))

n, m = tuple(map(int, input().split()))

perfgroups = n % m
impfgroups = m - perfgroups
szimpfgroups = n // m
szperfgroups = ceil(n / m)

kmin = perfgroups * comb(szperfgroups, 2) + impfgroups * comb(szimpfgroups, 2)
kmax = int(comb(n - m + 1, 2))
print(kmin, kmax)

#
#   478B. Random Teams
#

def nC2(n):
    return n * (n - 1) / 2

def min_friends(n, m):
    return nC2(n / m) * m + (n / m) * (n % m)

def max_friends(n, m):
    return nC2(n - m + 1)

n, m = map(int, raw_input().split())

print min_friends(n, m), max_friends(n, m)

def comb(n, k):
    assert k >= 0
    assert n >= k
    if k == 0:
        return 1
    res = 1
    for i in xrange(k):
        res *= (n - i)
    for i in xrange(k):
        res /= (i + 1)
    return res

def random_team(n, m):
    assert m > 0
    assert n >= m

    largest = n - m + 1
    if largest < 2:
        return 0, 0
    max_f = comb(largest, 2)
    av = n / m
    mo = n % m

    min_f = mo * comb(av + 1, 2)
    if av > 1:
        min_f += (m - mo) * comb(av, 2)

    return min_f, max_f

if __name__ == '__main__':
    array = raw_input().strip().split()
    n = int(array[0])
    m = int(array[1])
    min_f, max_f = random_team(n, m)
    print min_f, max_f

n, m = map(int, raw_input().strip().split())

minn=(m-n%m)*((n/m)*(n/m-1)/2)+(n%m)*(n/m+1)*(n/m)/2
maxx=(n-m+1)*(n-m)/2

print minn, maxx

n,m = map(int,input().split())

kmax = n-m+1

kmax = (kmax*(kmax-1))//2
kmin = ((n//m) *((n//m)-1))//2
if n%m==0:
    kmin = kmin * m
else:
    kmin = kmin * (m - (n%m))
    lftovers = (n//m)*((n//m)+1)//2
    kmin += lftovers*(n%m)
print(int(kmin),int(kmax))

temp = raw_input().split()
n = int(temp[0])
m = int(temp[1])
ave = n/m
minnum = ave*(n%m) + ave*(ave-1)*m/2
maxnum = (n-m+1)*(n-m)/2
print minnum,' ',maxnum

"""
  ____          _      _____
 / ___|___   __| | ___|  ___|__  _ __ ___ ___  ___
| |   / _ \ / _` |/ _ \ |_ / _ \| '__/ __/ _ \/ __|
| |__| (_) | (_| |  __/  _| (_) | | | (_|  __/\__ \
 \____\___/ \__,_|\___|_|  \___/|_|  \___\___||___/

"""
"""
░░██▄░░░░░░░░░░░▄██
░▄▀░█▄░░░░░░░░▄█░░█░
░█░▄░█▄░░░░░░▄█░▄░█░
░█░██████████████▄█░
░█████▀▀████▀▀█████░
▄█▀█▀░░░████░░░▀▀███
██░░▀████▀▀████▀░░██
██░░░░█▀░░░░▀█░░░░██
███▄░░░░░░░░░░░░▄███
░▀███▄░░████░░▄███▀░
░░░▀██▄░▀██▀░▄██▀░░░
░░░░░░▀██████▀░░░░░░
░░░░░░░░░░░░░░░░░░░░
"""

import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd
#sys.stdin = open('input.txt', 'r')
#sys.stdout = open('output.txt', 'w')

from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2**20)

def ncr(n, r):
    r = min(r, n - r)
    numer = reduce(op.mul, range(n, n - r, -1), 1)
    denom = reduce(op.mul, range(1, r + 1), 1)
    return numer // denom  # or / in Python 2

def isPowerOfTwo(x):
    return (x and (not(x & (x - 1))))

def factors(n):
    return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

T = 1
# T = int(stdin.readline())
for _ in range(T):
    # s = str(stdin.readline().strip('\n'))
    # a, b = list(map(int, stdin.readline().split()))
    # s = list(stdin.readline().strip('\n'))
    # b = list(stdin.readline().strip('\n'))
    # n = int(stdin.readline())
    # n, m = list(map(int, stdin.readline().split()))
    n, m = list(map(int, stdin.readline().split()))
    if n == m:
        print(0, 0)
        continue
    kx = ncr(n - (m - 1), 2)
    x = n // m
    y = n % m
    if x > 1:
        kn = ncr(x + 1, 2) * (y) + ncr(x, 2) * (m - y)
    else:
        kn = ncr(x + 1, 2) * (y)
    print(kn, kx)

n,m=map(int, raw_input().split())
maxi=n-m+1
maxiposs=maxi*(maxi-1)/2
remteams=n%m
remteamsval=(n/m) + 1
miniposs=remteams*remteamsval*(remteamsval-1)/2
miniposs+=(m-remteams)*(n/m)*((n/m)-1)/2
print miniposs,maxiposs

def links(x):
    return (x * (x - 1)) / 2

n, m = map(int, raw_input().split())

mn = (m - (n % m)) * links(n/m) + (n % m) * links(n/m + 1)

print mn, links(n - m + 1)

n,m = map(int,raw_input().split())

def pairs(n):
  return (n * (n - 1) / 2)

a = n / m
b = n % m

mi = pairs(a) * (m - b) + pairs(a + 1) * b
ma = pairs(n - m + 1)

print(str(mi) + ' ' + str(ma))

n,k=map(int,input().split())

flag=1
if n==1:
    print("0","0")
    flag=0
elif n<=k:
    print("0","0")
    flag=0
if flag==1:

    maxi=(n-k+1)*(n-k)//2
    x=n%k
    mini=0
    fe=n//k
    mini=((fe+1)*(fe)//2*x)+(k-x)*(fe)*(fe-1)//2
    print(mini,maxi,end=' ')

l1=[int(x) for x in input().split()]
n=l1[0]
m=l1[1]
#min
min1=n//m
n_min1=n-min1*m
min_half=((min1+1)*(min1)//2)*n_min1
min_full=(m-n_min1)*(min1*(min1-1)//2)
min_out=min_half+min_full
#max
max1=n-m
max_out=(1+(n-m))*(n-m)//2
print(int(min_out),int(max_out))

import math

persons, teams = map(int, input().split())

def comb(size_team):
    if size_team < 2:
        return 0
    else:
        return ((size_team)*(size_team-1))//2

# minimum -> teams with the same amount of people

persons_remaining = persons - teams
add_people_per_team = persons_remaining//teams
remaining = persons_remaining%teams
minimum = (teams-remaining)*comb(1+add_people_per_team)
minimum += remaining*comb(2+add_people_per_team)

# maximum -> teams with 1 person and 1 team with the remaining

people_last_team = persons - (teams-1)
maximum = comb(people_last_team)

print(int(minimum), int(maximum))

import sys
import math
import collections
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_list(): return list(map(int, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip()
for t in range(1):
    n,m=get_ints()
    maxim=n-m+1
    c_max=maxim*(maxim-1)//2
    minim=math.ceil(n/m)
    rem=(minim*m)-n
    big_min_count,big_min_value=m-rem,minim
    small_min_count,smaall_min_value=rem,minim-1
    c_min_big=big_min_count*(big_min_value*(big_min_value-1)//2)
    c_min_small=small_min_count*(smaall_min_value*(smaall_min_value-1)//2)
    c_min=c_min_big+c_min_small
    print(c_min,c_max)

def ii(): return int(input())
def fi(): return float(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

import math

n,m=mi()
a=math.ceil(n/m)
b=n%m
d=(m-b)
c=(n-(b*a))//d
y=n-m+1
y=y*(y-1)
y//=2
x=b*((a*(a-1))//2)+d*((c*(c-1))//2)
print(x,y)

import math

n, m = map(int, input().split())
kmax = 0
kmin = 0
if n == 1:
    kmax = 0
    kmin = 0
elif m == 1:
    kmin = kmax = (n * (n - 1)) / 2
else:
    x=n//m
    y=n-(x*m)
    kmin=(y*x*(x+1)/2)+ ((m-y)*x*(x-1)/2)
    kmax = (n - m + 1) * (n - m) // 2
print(int(kmin), int(kmax))

n,m=map(int,input().split())
kmax=((n-m+1)*(n-m))//2
quo=n//m
rem=n%m
kmin=rem*((quo*(quo+1))//2)+(m-rem)*((quo*(quo-1))//2)
print(kmin,kmax)

def choose(n,r):
    r = max(r,n-r)
    if n == 1:
        return 0
    out = 1
    for i in range(r+1,n+1):
        out *= i
    for i in range(1,n-r+1):
        out = out // i
    return out

l = input().split()
n = int(l[0])
m = int(l[1])
d = n // m
o = n % m
p = m-o

print(o*choose((d+1),2)+p*choose(d,2),choose(n-m+1,2))

n, m = [int(x) for x in input().split()]
f = lambda x: x*(x-1)//2
size = n//m
r = n%m
ans1 = f(n//m)*(m-r) + f(n//m+1)*r
ans2 = f(n-m+1)
print(ans1,ans2)

# Random Teams

n, m = map(int, raw_input().split())

def comb(i):
    if i == 2:
        return 1
    elif i > 2:
        return (i * (i - 1)) / 2
    else:
        return 0

maxPairs = comb(n - m + 1)
minPairs = None
if m == 1:
    minPairs = maxPairs
elif n % m == 0:
    minPairs = m * comb(n / m)
else:
    mod = n % m
    minPairs = mod * comb(n/m + 1) + (m - mod) * comb(n/m)

print "%i %i" % (minPairs, maxPairs)

from sys import stdin
import math

def count(n):
    n = n - 1
    return n*(n + 1) / 2

people, groups = map(int, stdin.readline().split())

max = people - (groups - 1)

x = people / groups
min = count(x + 1) * (people%groups) + count(x) * (groups -people%groups)

print min, count(max)

# Author Kmoussai
import sys
import math
import random
'''
i = 0
while i < n:

    i += 1

map(int, input().split())

def pgcd(a, b):
    if b == 0:
        return a
    return pgcd(b, a%b)

'''
if len(sys.argv) >= 2:
    if sys.argv[1] == 'LOCAL':
        sys.stdin = open('input.in', 'r')

n,m = map(int, input().split())
t = (n - (m - 1))
maxx = int((t*(t - 1))//2)

t = n // m

if n%m == 0:
    minn = (t*(t - 1))//2
    minn *= m
else:
    t = n//m
    minn = ((t*(t - 1))//2)  * (m - n%m)
    t += 1
    minn += ((t*(t - 1))//2)  * (n%m)

print(minn, maxx)

def pair(a):
    return (a*(a-1))//2

n,m = [int(i) for i in input().split()]

nmat = n-(m-1)
nmat = pair(nmat)

if(n%m != 0):
    k=n//m
    nmit = pair(k+1)*(n%m)
    nmit += pair(k)*(m-(n%m))
else:
    nmit = pair((n//m))*(n//(n//m))

print(nmit,nmat)

import bisect

def ni():
    return int(raw_input())

def nis():
    return map(int, raw_input().split())

def si():
    return raw_input()

def sis():
    return raw_input().split()

def pairs(n):
    return n * (n - 1) / 2

n, m = nis()

avg_team = n / m
rem = n % m
a = (m - rem) * pairs(avg_team) + rem * pairs(avg_team + 1)

max_team = n - (m - 1)
b = pairs(max_team)

print a, b

n, m = map(int, raw_input().split())

# get Min
minCombo = 0
nPerM = n / m
if n / m > 1:
    minCombo += (nPerM * (nPerM -1)/2) * (m - (n % m))
nSpecial = nPerM + 1
minCombo += (nSpecial * (nSpecial - 1)/2) * (n % m)

# get Max
maxCombo = 0
maxN = n - (m - 1)
maxCombo += (maxN * (maxN - 1)) / 2

print minCombo, maxCombo

#------------------------template--------------------------#
import os
import sys
from math import *
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
def array():
    return [int(i) for i in input().split()]
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#-------------------------code---------------------------#
#vsInput()

def nc2(n):
    if(n==1):
        return 0
    return n*(n-1)//2

n,k=map(int,input().split())
kmin=0
kmax=nc2(n-k+1)
kmin=nc2(n//k)*(k-n%k)+nc2(n//k+1)*(n%k)
print(kmin,kmax)

string = input()
numbers = string.split(" ")
total = int(numbers[0])
teams = int(numbers[1])
n = total // teams
a = n * (n - 1) // 2 * teams + total % teams * n
n = total - (teams - 1)
b = n * (n - 1) // 2
print("%d %d" % (a, b))

'''input
5 1
'''
from sys import stdin, stdout
import math

def combination(a, b):
	if a >= 2:
		return (a * (a - 1)) // 2
	else:
		return 0

def calculate_min(n, m):
	temp = n // m
	remain = n % m

	ans = (m - remain) * combination(temp, 2)
	ans += remain * combination(temp + 1, 2)
	return ans
	# temp = math.ceil(n/m)
	# temp2 = n // temp
	# #print(temp, temp2)
	# r = n % m
	# if r == 0:
	# 	return combination(temp, 2) * m
	# else:
	# 	return combination(temp, 2) * (min(m - 1, temp2) ) + combination(n - (temp2 * temp), 2)

def calculate_max(n, m):
	return combination(n - (m - 1), 2)

# main starts
n, m = list(map(int, stdin.readline().split()))
second = calculate_max(n, m)
first = calculate_min(n, m)
print(first, second)

# -*- coding: utf-8 -*-
"""
Created on Fri Apr  3 15:16:34 2020

@author: SOUVIK PAN
"""
n,m = map(int,input().split())
kn=(n-m+1)*(n-m)//2
a=n//m
km= m*a*(a-1)//2 + a*(n%m)
print(km,kn)

def main():

    n,m = [int(i) for i in raw_input().split(" ")]

    #min
    p,t = n,m
    if p%t == 0:
        ppt = p/t
        print t * ( ppt * (ppt-1) )/2,
    else:
        ppt = p/t
        r = p%t

        print r * ( (ppt+1) *ppt )/2 + (t-r) * ( ppt * (ppt-1) )/2,

    #max
    p,t = n,m
    p -= t-1
    print (p*(p-1))/2

main()

from __future__ import nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals
import sys, os, time
input = raw_input
range = xrange

def rv(): return map(int, input().split())
def rl(n): return [list(map(int, input().split())) for _ in range(n)]
if os.path.exists("test.txt"): sys.stdin = open("test.txt")
# sys.stdout = open(pass, 'w')

def gmin(n, m):
    small = n // m
    moars = n - small * m
    moaramount = moars * small
    return m * (small - 1) * small // 2 + moaramount

def gmax(n, m):
    maxteam = n - m + 1
    return maxteam * (maxteam - 1) // 2

def solve():
    n,m, = rv()
    print(gmin(n, m), gmax(n, m))

solve()

def main():

    n,m = map(int,input().split())
    rem = n%m
    q = n//m
    min_friend  = 0
    if q-2 >= 0:
        min_friend += (m-rem)*((q*(q-1))//2)
    if q-1 >= 0 and rem > 0:
        min_friend +=  rem*((q+1)*q)//2
    max_friend = 0
    if m != n:
        max_friend = (n-m+1)*(n-m)//2
    print(min_friend,max_friend)
if __name__ == '__main__':
    main()

n, m = map(int, raw_input().split())

def getResult(value):
    return value * (value + 1) / 2

rest = n % m
aux = n // m

maximum = getResult(n - m)
minimum = (getResult(aux) * rest) + (getResult(aux - 1) * (m - rest))

print(str(minimum) + ' ' + str(maximum))

from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

def input():
    return sys.stdin.readline().strip()

def iinput():
    return int(input())

def tinput():
    return input().split()

def rinput():
    return map(int, tinput())

def rlinput():
    return list(rinput())

mod = int(1e9)+7

def factors(n):
    return set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

# ----------------------------------------------------

def f(n):
    return n*(n-1)//2

if __name__ == "__main__":
    n, m = rinput()
    kmax = f(n-m+1)
    q, r = divmod(n, m)
    kmin = (m-r)*f(q) + r*f(q+1)
    print(kmin, kmax)

# cook your dish here
n, m = list(map(int, input().split()))
maxvalue = ((n-m+1)*(n-m))//2
minvalue = ((n%m)*((n//m) + 1)*(n//m))//2
if n//m > 1:
    minvalue += ((m-(n%m))*(n//m)*((n//m)-1))//2
print(minvalue, maxvalue)

n,m=map(int,raw_input().split())
a=n/m
print m*a*(a-1)/2+a*(n%m),(n-m)*(n-m+1)/2

from sys import stdin,stdout,setrecursionlimit,maxint,exit
#setrecursionlimit(2*10**5)
def listInput():
 return map(long,stdin.readline().split())
def printBS(li):
 for i in xrange(len(li)-1):
  stdout.write("%d "%li[i])
 stdout.write("%d\n"%li[-1])
def sin(): return stdin.readline().rstrip()
n,m=listInput()
ma=n-m+1
ma=(ma*(ma-1))/2
mi=n/m
r=n%m
mi=r*(((mi+1)*mi)/2)+(m-r)*((mi*(mi-1))/2)
print mi,ma

ins = [int(i) for i in input().split()]
p,t = ins

most = (p-t)*(p-t+1)//2
if t==1:
    least = most
else:
    least = (t-p%t)*(p//t-1)*(p//t)//2 + p%t*(p//t)*(p//t+1)//2
print(least,most)

def inp():
    return map(int, stdin.readline().split())

def nCr(n, r):
    f, m = factorial, 1
    for i in range(n, n - r, -1):
        m *= i
    return int(m // f(r))

from math import *
from sys import *

n, m = inp()
mi = nCr((n // m) + 1, 2) * (n % m) + nCr(n // m, 2) * (m - (n % m))
ma = nCr(n - (m - 1), 2)
print(mi, ma)

def inp():
    return map(int, stdin.readline().split())

def nCr(n, r):
    f, m = factorial, 1
    for i in range(n, n - r, -1):
        m *= i
    return int(m // f(r))

from math import *
from sys import *

n, m = inp()
if n % m == 0:
    mi = nCr(n // m, 2) * m
else:
    mi = nCr((n // m) + 1, 2) * (n % m) + nCr(n // m, 2) * (m - (n % m))

ma = nCr(n - (m - 1), 2)
print(mi, ma)

import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
# from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
# import numpy as np
starttime = time.time()
# import numpy as np
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

try:
    # sys.setrecursionlimit(int(pow(10,6)))
    sys.stdin = open("input.txt", "r")
    # sys.stdout = open("../output.txt", "w")
except:
    pass
n,m=L()
def nC2(x):
    return x*(x-1)//2

mn=(m - n % m) * (nC2(n//m)) + (n % m) * (nC2(n//m + 1))

x=n-(m-1)
mx=x*(x-1)//2
print(int(mn),mx)
endtime = time.time()
# print(f"Runtime of the program is {endtime - starttime}")

from collections import *
from bisect import *
from math import *
from heapq import *
from fractions import *
import sys
input=sys.stdin.readline
t=1
def r(a):
    return ((a*(a-1))//2)
while(t):
    t-=1
    n,k=map(int,input().split())
    q=n//k
    n1=n-(k*q)
    kmin=r(q+1)*(n1)
    kmin+=r(q)*(k-n1)
    kmax=r(n-k+1)
    print(kmin,kmax)

n,m = map(int, input().split())

def combination(n):
    return int((n*.5*(n-1)))
def minTeam(n,m):
    if(n==0 and m==0):
        return 0
    if(n%m==0):
        return m*combination(n//m)
    else:
        return (m-(n%m))*combination(n//m)+(n%m)*combination(n//m+1)

print(minTeam(n,m) ,(n-m+1)*(n-m)//2)

# 9223372036854775807
# 998001000999000064
# 499000500499500032

n, m = map( int, input().split() )

# for min

r = n % m
q = n / m

a = r * (q+1) * (q) / 2

a += (m - r) * q * (q - 1) / 2

print(int(a))

# for maximum

N = n - m + 1
a = N * (N - 1) / 2
print(int(a))

from math import *
n,m=map(int,input().split())
if m==1:print(n*(n-1)//2,n*(n-1)//2)
else:
    minim=[ceil(n/m) for i in range(m-1)]
    maxim=[1 for i in range(m-1)]
    maxim.append(n-m+1)
    minim.append(n-sum(minim))
    sum1,sum2=0,0
    for i in minim:sum1+=i*(i-1)//2
    for i in maxim:sum2+=i*(i-1)//2
    print(sum1,sum2)

import math

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

n, m = map(int, raw_input().split())

# get Min
minCombo = 0
nPerM = n / m
if n / m > 1:
    minCombo += nCr(nPerM, 2) * (m - 1)
nSpecial = nPerM + (n % m)
minCombo += nCr(nSpecial, 2)

# get Max
maxCombo = 0
maxN = n - (m - 1)
maxCombo += nCr(maxN, 2)

print minCombo, maxCombo

n, m =[int(x) for x in input().split()]
f = lambda x: x*(x-1)//2
size = n//m
if n%m==0:
    ans1 = m*f(size)
else:
    ans1 = (m-1)*f(size)+f(n-size*(m-1))
ans2 = f(n-m+1)
print(ans1,ans2)

import math

def ncr(a):
    return a * (a-1) / 2

n, m = [int(x) for x in raw_input().split()]

print (ncr(n/m) * m + (n%m)*n/m), ncr(n+1-m)

def combi(a):
    return (a*(a-1))/2

N, M = map(int, raw_input().split())
k = N / M
x = N % M
Mx, Mn = combi(N-(M-1)), 0
Mn = (M-x)*combi(k) + (x)*(x*(x+1))/2
print Mn, Mx

n,m = map(int,raw_input().strip().split(' '))
if m!= 1:
    maxfp = (n*(m-1))/2
else:
    maxfp = (n*(n-1))/2

if m==1:
    minfp = maxfp
else:
    if m<n/2:
        minfp = m-1+(n+1)/2
    else:
        minfp = n-m
print minfp, maxfp

def sumTillN(N):
    return int((N*(N-1)) / 2)
N,M = map(int,input().split())
Max = sumTillN(N - (M-1))
Number = int(N//M)
Some = N%M
X = Some * sumTillN(Number+1)
Y = (M - Some) * sumTillN(Number)
Min = X+Y
print(Min,Max)

n,m = [int(i) for i in input().split()]

pair = [0,0]

for i in range(2,n+1):
    pair.append((i-1)+pair[i-1])

nmat = n-(m-1)
nmat = pair[nmat]
if(n%m != 0):
    k = m-(n%m)
    k+=n//m
    nmit = pair[k]*(n%m)
else:
    nmit = pair[(n//m)]*(n//(n//m))

print(nmit,nmat)

import math
from math import ceil
from math import floor
numbers = map(float, raw_input().split())
m = numbers[0]
n = numbers[1]
large = (m-n+1)*(m-n)/2

major = math.ceil(m/n)
minor = math.floor(m/n)
num_major = m-n*(m//n)
num_minor = n-num_major

small = num_major*(major*(major-1))/2 + num_minor * (minor*(minor-1))/2
print int(small), int(large)

n, m = map( int, input().split() )

# for min

r = n % m
q = n // m

a = r * (q+1) * (q) / 2
a += (m - r) * q * (q - 1) / 2

print(int(a))

# for maximum

N = n - m + 1
a = N * (N - 1) / 2
print(int(a))

import math

def cnt(n):
    return (n*(n-1))//2

n, m = [int(x) for x in input().split()]
print((m-n % m)*cnt(n//m) + (n % m)*cnt(n/m+1), cnt(n - m + 1))

n,m=map(int,raw_input().split())
def combin(n, k):
    """Nombre de combinaisons de n objets pris k a k"""
    if k > n//2:
        k = n-k
    x = 1
    y = 1
    i = n-k+1
    while i <= n:
        x = (x*i)//y
        y += 1
        i += 1
    return x
maxi=combin(n-m+1,2)
a=n/m
mini= m*a*(a-1)/2+a*(n%m)
print mini,maxi

n, m = map(int, input().split())

if m == 1:
	ans = (n*(n-1))//2
	print(ans, ans)

elif n == m:
	print(0, 0)

else:

	s = n-m

	kmax = ((s+1)*(s))//2

	f = n//m
	r = n%m

	total = 0

	total+= ((f)*(f-1))//2

	total*=(m-r)

	t2=((f+r)*(f+r-1))//2
	t2*=r

	total+=t2

	print(total, kmax)

a,b=map(int,raw_input().split())
d=a-(b-1)
if a%b==0:
    r=a/b
    ans=b*r*(r-1)/2
else:
    r=a/b+1
    ff=r*b-a
    ans=(b-ff)*r*(r-1)/2
    fa=a-(b-1)*r
    ans+=ff*fa*(fa-1)/2
print ans,d*(d-1)/2

import math
l=[int(x) for x in raw_input().split()]
n=l[0]
m=l[1]
ndiv=m-1
def round(k):
    ksize=k*10
    size=0
    if int(ksize)%10>=5:
        size=math.ceil(k)
    else:
        size=math.floor(k)
    return size
def comb(n,m):
    ans=(n*(n-1))/2
    return ans
def maxno(n,ndiv):
    n=n-ndiv
    #print n
    k=comb(n,2)
    #print k
    return k
def minno(n,ndiv):
    #Need to find the number of division of teams, so keep dividing by 2 until you find the required number of teams
    teamsize=float(n)
    npart=ndiv
    times=1
    size=n
    #Need size of each partition
    size=teamsize/(ndiv+1)
    ksize=size*10
    #print size
    #print ksize
    if int(ksize)%10>=5:

        size=math.ceil(size)
        #print "yoko1"
    else:
        size=math.floor(size)
        #print ksize%10
        #print "yoko2"
    n=int(size)
    #print n
    if n==1:
        n=2
    ans1=comb(n,2)
    titer=0
    q=0
    while q<teamsize:
        q=q+n
        titer+=1
    q=q-n
    titer-=1
    diff=teamsize-q
    ans2=comb(diff,2)
    ans=ans1*titer+ans2
    if npart+1>round(teamsize/2):
        diff=npart+1-teamsize/2
        ans=teamsize/2-diff
        if teamsize%2==1:
            ans+=1
    return ans
a1=maxno(n,ndiv)
a2=minno(n,ndiv)
print long(a2),long(a1)

n,t = input().split()
n = int(n)
t = int(t)

def sm(n):

    return (n*(n-1))/2
if t == 1:
    mx = sm(n)
    mn = sm(n)
else:
    mx = sm(n-t+1)
    if n%t == 0:
        mn = t*sm(int(n/t))
    else:
        x = n%t
        mn = x*(sm(int(n//t+1))) + (t-x)*sm(int(n//t))

print (int(mn),int(mx))

from collections import *
from bisect import *
#from math import *
from heapq import *
from fractions import *
import sys
input=sys.stdin.readline
t=1
def r(a):
    return ((a*(a-1))//2)
while(t):
    t-=1
    n,k=map(int,input().split())
    q=n//k
    re=n%k
    kmin=r(q)*(n//q)
    kmin+=r(re)
    kmax=r(n-k+1)
    print(kmin,kmax)

import math
l=[int(x) for x in raw_input().split()]
n=l[0]
m=l[1]
ndiv=m-1
def fact(k):
    ans=1
    if k<0:
        return 1
    else:
        return math.factorial(k)
def comb(n,m):
    ans=(n*(n-1))/2
    return ans
def maxno(n,ndiv):
    n=n-ndiv
    #print n
    k=comb(n,2)
    #print k
    return k
def minno(n,ndiv):
    #Need to find the number of division of teams, so keep dividing by 2 until you find the required number of teams
    teamsize=n
    npart=ndiv
    times=1
    size=n
    #Need size of each partition
    size=float(teamsize/(ndiv+1))
    ksize=size*10
    if int(ksize)%10>=5:
        size=math.ceil(size)
    else:
        size=math.floor(size)
    n=int(size)
    if n==1:
        n=2
    ans1=comb(n,2)
    titer=0
    q=0
    while q<teamsize:
        q=q+n
        titer+=1
    q=q-n
    titer-=1
    diff=teamsize-q
    ans2=comb(diff,2)
    ans=ans1*titer+ans2
    if npart+1>teamsize/2:
        diff=npart+1-teamsize/2
        ans=teamsize/2-diff
        if teamsize%2==1:
            ans+=1
    return ans
a1=maxno(n,ndiv)
a2=minno(n,ndiv)
print a2,a1

filename = "input1.txt"
import sys
caonima = True
if caonima:
    f = sys.stdin
else:
    f = open(filename)

n,m = map(int,f.readline().split())
if n%m==0:
    k = n/m
    kmin = k*(k-1)/2*m
else:
    k1 = n/m
    k2 = n-(m-1)*k1
    kmin = k2*(k2-1)/2 + k1*(k1-1)/2*(m-1)
k = n-(m-1)
kmax = (k-1)*k/2
print kmin,kmax

#with open( "2.out", "w") as f1:
#    for i in ans:
#        j = str(i)+'\n'
        #print j
#        f1.write(j)

# coding=utf-8

if __name__ == '__main__':
    n, m = str(input()).split()
    n = int(n)
    m = int(m)
    k_max = int((n + 1 - m) * (n - m) / 2)
    k_min = (m - (n - m * int(n / m))) * int(int(n / m) * (int(n / m) - 1) / 2) + (n - m * int(n / m)) * int(int(n / m) * (int(n / m) + 1) / 2)
    print(str(k_min)+' '+str(k_max))

w=input().split(" ")
n=int(w[0])
m=int(w[1])
formax=n-m
maxx=int((formax)*(formax+1)/2)
a=n//m
b=n%m
minn=int((b*(a*(a+1)/2))+((m-b)*(a*(a-1)/2)))
print(str(minn)+" "+str(maxx))

import math

n, m = map(int, input().split())

c_max = n - m + 1
c_min = math.ceil(n/m)

# print(c_min, c_max)

def s(i):
    return round((i*(i-1))/2)

k_max = s(c_max)

if n % m:
    k_min1 = s(c_min)*(m-1)
    k_min1 += s(n % c_min)

    c_min = math.floor(n/m)
    k_min2 = s(c_min)*(m-1)
    k_min2 += s(c_min + (n % m))
    k_min = min(k_min1, k_min2)
else:
    k_min = s(c_min)*m

print( k_min, k_max )

import math
x,y = map(int, input().strip().split())
x = x-y
kmax = ((x+1)*x)/2
w = int((x+y)/y) #number of people in one team
k = (x+y)%y # NUMBER OF CASES WHER WE NEED TO +1 ON W
kmin = ((y-k)*w*(w-1))/2 +(k*w*(w+1))/2
kmin = int(kmin)
kmax =int(kmax)
print(kmin,kmax)

n,m = map(int, input().split())

def combination(n):
    return int((n*(n-1))/2)
def minTeam(n,m):
    if(n==0 and m==0):
        return 0
    if(n%m==0):
        return m*combination(n//m)
    else:
        return (m-(n%m))*combination(n//m)+(n%m)*combination(n//m+1)

print(minTeam(n,m) ,combination(n-m+1))

from math import ceil
n,m=map(int,input().split())

max = ((n-m+1)*(n-m))//2

k=ceil(n/m)
min = (m-1)*k*(k-1)//2 + (n-m*k +k)*(n-m*k+k-1)//2

print(min,max)

n, m = list(map(int, input().split(" ")))

def count_friends(num):
    return int(((num-1)/2)*(num))

#Max
maxFriends = count_friends(n - (m-1))

#Min
minFriends = 0
if n % m == 0:
    min = int(n/m)
    minFriends += count_friends(min)*m
else:
    roundNum = int(n/m)
    ostatok = n % m
    minFriends += count_friends(roundNum) * (m - ostatok)
    minFriends += count_friends(roundNum + 1) * ostatok

print(str(maxFriends) + " "  + str(minFriends))

import math

entrada = [int(x) for x in raw_input().split()]

n = entrada[0]
m = entrada[1]

max_ind = n-(m-1)
max = 0
if max_ind<=1:
	max = 0
else:
	max = math.factorial(max_ind)/((math.factorial(max_ind-2))*2)

min_ind = n/m
temp = n
tamanho = 0

for i in range(m-1):
	if temp>=min_ind:
		temp-=min_ind
		tamanho+=1
min = 0

if n==m:
	min = 0
else:
	if min_ind>1:
		for i in range(tamanho):
			min+=math.factorial(min_ind)/((math.factorial(min_ind-2))*2)
	min+=math.factorial(n-(min_ind*tamanho))/((math.factorial(n-(min_ind*tamanho)-2))*2)
print min, max

n,m=map(int,input().split())
N=n-(m-1)
maxi=(N-1)*N/2
if n%m==0:
    N=n/m
    mini=m*(N-1)*N/2
else:
    N=(n-n%m)//(m-1)
    N_ost=n%m
    mini=(m-1)*(N-1)*N/2+(N_ost-1)*N_ost/2
print(int(mini),int(maxi))

def ncr(n1):
    f=(n1*(n1-1))//2
    return f

n,m=input().split(" ")
n=int(n)
m=int(m)
c=n-m

Max=ncr(c+1)
s=n//m
s1=n%m
d=m*(ncr(s))
d1=s1*(ncr((s+1)))
Sum=d+d1

print(Sum,Max)

from math import factorial
n,m = map(int,input().split())

def ncr(n,r):
    try:
      z = (factorial(n))//(factorial(r)*factorial(n-r))
    except:
        z = 0
    return z

max = ncr(n-m+1,2)

if n%m!=0:
 z = (n//m)+1
 f = m//z
 min = f*ncr(z,2) + ncr(n-f*z,2)
else:
    z = (n//m)

    min = m*ncr(z,2)

n, m = map(int, input().split())

kmax = int((n-m+1) * (n-m) / 2)

if n % m == 0: # Uniformly
    kmin = int(m * ((n/m * (n/m-1)) / 2))
else:
    temp = int(n/m)
    team1 = n % m  # How many teams have int(n/m)+1 member
    team2 = m - team1  # How many teams have int(n/m) member
    kmin1 = team1 * (((temp+1) * temp) / 2)
    kmin2 = team2 * (((temp-1) * temp) / 2)
    kmin = int(kmin1 + kmin2)
print(kmin, kmax)

n,m = map(int,input().split())
if(m==1):
    ma = n*(n-1)//2
    mi = n
else:
    mi = n//2
    ma = (n-m+1)*(n-m)//2

print(mi,ma)

n,m = map(int,input().split())
if(m==1):
    ma = n*(n-1)//2
    mi = 2*n
else:
    mi = n//2
    ma = (n-m+1)*(n-m)//2

print(mi,ma)

#
#   478B. Random Teams
#

def nC2(n):
    return n * (n - 1) / 2

def min_friends(n, m):
    return nC2(n / m) * (m - 1) + nC2(n / m + n % m)

def max_friends(n, m):
    return nC2(n - m + 1)

n, m = map(int, raw_input().split())

print min_friends(n, m), max_friends(n, m)

n,m=map(int,input().split())
count=0
if m==1:
  count=(n*(n-1))/2
  print(str(int(count))+' '+str(int(count)))
elif n%m==0:
  a=int(n/m)
  p=(a*(a-1))/2
  min=int(p*m)
  a=n-m
  p=((a+1)*a)/2
  max=int(p)
  print(str(min)+' '+str(max))
else:
  a=int(n/m)
  if a>1:
    count=(a*(a-1))/2
  a=int((n-int(n/m))/(n%m))
  p=(a*(a-1))/2
  min=int(count+(n%m)*p)
  a=n-m
  max=int(((a+1)*a)/2)
  print(str(min)+' '+str(max))

from functools import reduce
import operator as op
n,m=map(int,input().split())
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer//denom
maxx=ncr(n-m+1,2)
q=n//m
r=n%m
minn=ncr(q+1,2)*r
if(q>1):
  minn+=ncr(q,2)*(m-r)
print(minn,end='')
print(" ",end='')
print(maxx)

n,m = map(int, input().split())

minimum = 0
ppl = n

ppl -= m
ppl += 1
minimum = (ppl*(ppl-1))//2

maximum = 0
ppl = n

team_size = (ppl//m)
if ppl%m!=0:
	team_size+=1
team_all = ppl//team_size
team_rem = ppl%team_size

maximum += (team_size*(team_size-1))//2
maximum*=team_all
maximum += (team_rem*(team_rem-1))//2

print(maximum, minimum)

#Finish -->

from collections import *
from bisect import *
from math import *
from heapq import *
from fractions import *
import sys
input=sys.stdin.readline
t=1
def r(a):
    return ((a*(a-1))//2)
while(t):
    t-=1
    n,k=map(int,input().split())
    q=ceil(n/k)
    re=n-(q*(n//q))
    kmin=r(q)*(n//q)
    kmin+=r(re)
    kmax=r(n-k+1)
    print(kmin,kmax)

import math
n,m=map(int,input().split())
if n==m:
    print(0)
else:
    max_val=n-(m-1)
    minimum=0
    if max_val>1:
        maximum=max_val*(max_val-1)/2
    else:
        maximum=0
    l=[int(n/m) for x in range(m)]
    for i in range(n%m):
        l[i]+=1
    for i in l:
        if i==1:
            break
        if i==l[-1]:
            no=len(l)-l.index(i)
            minimum+=(i*(i-1)/2)*no
            break
        minimum+=i*(i-1)/2
    print(int(minimum),int(maximum))

# -*- coding: utf-8 -*-
"""
Created on Fri Apr  3 15:16:34 2020

@author: SOUVIK PAN
"""
n,m = map(int,input().split())
kn=int((n-m+1)*(n-m)/2)
if n-m>=m:
    km= int(m-1 + (n-2*m+2)*(n-2*m+1)/2)
else:
    km=n-m
print(km,kn)

import sys
import math
input=sys.stdin.readline
def ncr(n):
    return((n*(n-1))//2)
n,m=(int(i) for i in input().split())
mi=(ncr(n//m))*(m-1)+ncr((n//m)+(n%m))
ma=ncr(n-m+1)
print(mi,ma)

n, m = list(map(int, "5 1".split(" ")))

def count_friends(num):
    return int(((num-1)/2)*(num))

#Max
maxFriends = count_friends(n - (m-1))

#Min
minFriends = 0
if n % m == 0:
    min = int(n/m)
    minFriends += count_friends(min)*m
else:
    roundNum = int(n/m)
    ostatok = n % m
    minFriends += count_friends(roundNum) * (m - ostatok)
    minFriends += count_friends(roundNum + 1) * ostatok

print(str(minFriends) + " "  + str(maxFriends))

def fac(n):
    f=1
    while n>0:
        f*=n
        n-=1
    return f
def ncr(n,m):
    if n<m:
        return 0
    ans=1
    for i in range(1,m+1):
        ans*=(n-i)
    return (ans//fac(m))
n,m=input().strip().split(' ')
n,m=(int(n),int(m))
list1=[1 for i in range(m)]
r=n-m
mx=ncr(n-m+1,2)
if r%m==0:
    mn=m*ncr(n//m,2)
else:
    mn=0
    mn+=(m*ncr((1+(r//m)),2))
    if r>m:
        mn+=ncr((1+(r%m)),2)
    else:
        mn+=r*1
print(mn,mx)

import math
n,m = map(int,input().split())

def comb(num):

    return int((num * (num-1)) / 2)

min_pair = 0
max_pair = 0
# 23 4
mem = n
team = m
if mem % team == 0 :
    min_pair = comb(int(mem/team)) * team
else :
    per_team = int(n / m)
    remainder = n % m
    min_pair = comb(per_team + 1) * remainder
    min_pair += comb(per_team) * (team - remainder)

n = n - m + 1
max_pair = comb(n)

print('{} {}'.format(min_pair,max_pair))

# 1833 195

n,m=map(int,input().split())
if m==1:print(n*(n-1)//2,n*(n-1)//2)
else:
    minim=[n//m for i in range(m-1)]
    maxim=[1 for i in range(m-1)]
    maxim.append(n-m+1)
    minim.append(n-sum(minim))
    sum1,sum2=0,0
    for i in minim:sum1+=i*(i-1)//2
    for i in maxim:sum2+=i*(i-1)//2
    print(sum1,sum2)

"""
  ____          _      _____
 / ___|___   __| | ___|  ___|__  _ __ ___ ___  ___
| |   / _ \ / _` |/ _ \ |_ / _ \| '__/ __/ _ \/ __|
| |__| (_) | (_| |  __/  _| (_) | | | (_|  __/\__ \
 \____\___/ \__,_|\___|_|  \___/|_|  \___\___||___/

"""
"""
░░██▄░░░░░░░░░░░▄██
░▄▀░█▄░░░░░░░░▄█░░█░
░█░▄░█▄░░░░░░▄█░▄░█░
░█░██████████████▄█░
░█████▀▀████▀▀█████░
▄█▀█▀░░░████░░░▀▀███
██░░▀████▀▀████▀░░██
██░░░░█▀░░░░▀█░░░░██
███▄░░░░░░░░░░░░▄███
░▀███▄░░████░░▄███▀░
░░░▀██▄░▀██▀░▄██▀░░░
░░░░░░▀██████▀░░░░░░
░░░░░░░░░░░░░░░░░░░░
"""

import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd
#sys.stdin = open('input.txt', 'r')
#sys.stdout = open('output.txt', 'w')

from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2**20)

def ncr(n, r):
    r = min(r, n - r)
    numer = reduce(op.mul, range(n, n - r, -1), 1)
    denom = reduce(op.mul, range(1, r + 1), 1)
    return numer // denom  # or / in Python 2

def isPowerOfTwo(x):
    return (x and (not(x & (x - 1))))

def factors(n):
    return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

T = 1
# T = int(stdin.readline())
for _ in range(T):
    # s = str(stdin.readline().strip('\n'))
    # a, b = list(map(int, stdin.readline().split()))
    # s = list(stdin.readline().strip('\n'))
    # b = list(stdin.readline().strip('\n'))
    # n = int(stdin.readline())
    # n, m = list(map(int, stdin.readline().split()))
    n, m = list(map(int, stdin.readline().split()))
    kx = ncr(n - (m - 1), 2)
    x = n // m
    y = n % m
    if x > 1:
        kn = ncr(x + 1, 2) * (y) + ncr(x, 2) * (m - y)
    else:
        kn = ncr(x + 1, 2) * (y)
    print(kn, kx)

def comb(n, k):
    assert k >= 0
    assert n >= k
    if k == 0:
        return 1
    res = 1
    for i in xrange(k):
        res *= (n - i)
    for i in xrange(k):
        res /= (i + 1)
    return res

def random_team(n, m):
    assert m > 0
    assert n >= m

    largest = n - m + 1
    if largest < 2:
        return 0, 0
    max_f = comb(largest, 2)
    av = n / m
    mo = n % m

    min_f = mo * comb(av + 1, 2)
    if av > 1:
        min_f = (m - mo) * comb(av, 2)

    return min_f, max_f

if __name__ == '__main__':
    array = raw_input().strip().split()
    n = int(array[0])
    m = int(array[1])
    min_f, max_f = random_team(n, m)
    print min_f, max_f

def C(n):
    if(n>=1):
        return (n*(n-1))/2
    else:
        return 0
n1,m1=raw_input().split()
n=int(n1);m=int(m1)
a=C(n-m+1)
q=n/m;r=n%m
b=((m-1)*C(q))+C(r+q)
print b,a

def c2(a):
    return (a*(a-1))//2
a=list(map(int,input().split()))
if a[0]==a[1]:
    print('0 0')
else:
    max=c2(a[0]+1-a[1])
    b=a[0]//a[1]
    c=a[0]%a[1]
    e=[]
    min=0
    for i in range(a[1]):
        if c!=0:
            e.append(b+c)
            c-=1
        else:
            e.append(b)
    for i in e:
        min+=c2(i)
print(min,end=' ')
print(max)

import math
def sum(n):
    return (n*(n-1))/2
def main():
    n,m=map(int,input().split())
    s= m-1
    mx= sum(n-(s))
    if m == 1 :mn = mx
    else: mn= m * (((n - m) // m + 1) * ((n - m) // m)) // 2 + math.ceil((n - m) / (m)) * ((n - m) % m)
    print(f'{int(mn)} {int(mx)}')

if __name__ == '__main__':
    main()

import math

def Choose2(n):
    if n < 2: return 1
    f = math.factorial
    return f(n) / f(2) / f(n-2)

a = raw_input().split()

n = int(a[0])
m = int(a[1])

remaining = n - m

# minimum if n is evenly distributed ( > m )
mx = Choose2(remaining+1)

# maximum if t
mnE = Choose2(round(remaining/m)+1)

if mnE == 1 and n == m+1: mn = 1
else: mn = m * mnE

print mn, mx

n, m = [int(p) for p in input().split()]
low, high = 0, 0
if n < m:
	print(low, high)
	exit()

# for low
curr = n
curr -= m
if curr > 0:
	if curr < m:
		low = curr
	elif curr == m:
		low = m
	else:
		curr -= m-1
		low += m-1 + (curr)*(curr+1)//2
# for high
curr = n
curr -= m
if curr > 0:
	high = (curr+1)*(curr)//2
print(low, high)

import math
n,m=map(int, raw_input().split())
divceil=math.ceil(n*1.0/m)
miniceil=n-divceil*(m-1)
minipossceil=miniceil*(miniceil-1)/2
miniceil=divceil
minipossceil+=(m-1)*miniceil*(miniceil-1)/2
divfloor=n/m
minipossfloor=(m-1)*divfloor*(divfloor-1)/2
minifloor=divfloor+n%m
minipossfloor+=minifloor*(minifloor-1)/2
miniposs=min(minipossceil,minipossfloor)
maxi=n-m+1
maxiposs=maxi*(maxi-1)/2
print int(miniposs),maxiposs

n,m = [int(x) for x in input().split()]
if n==m:
    kmax =0
    kmin=0
else:
    x=(n-m+1)
    kmax = (x*(x-1))/2
    member = n//m
    remaining=n%m
    kmin=remaining*(((member+1)*(member+1-1))/2)+(m-remaining)*((member*(member-1))/2)

print(int(kmin),int(kmax))

import sys

def calc(n):
    if n == 1:
        return 0
    return int((n-1) * n / 2)

m, n = map(int, sys.stdin.readline().split())

mmin = 0
left = m
each = int(m / n)
for i in range(n):
    if i == n-1:
        mmin += calc(left)
    else:
        mmin += calc(each)
        left -= each

mmax = 0
left = m
for i in range(n):
    if i == n-1:
        mmax += calc(left)
    else:
        left -= 1

print(mmin, mmax)

from math import factorial
import time
n, m = map(int, input().split())

if m == 1:
    kmin = kmax = factorial(n) // (factorial(2) * factorial(n - 2))
elif m == 2:
    if n == 2:
        kmax = kmin = 0
    elif n == 3:
        kmax = kmin = 1
    else:
        if n % 2 == 0:
            kmin = 2 * factorial(n // 2) // (factorial(2) * factorial((n // 2) - 2))
            kmax = factorial(n - 1 // 2) // (factorial(2) * factorial(n - 3))
        else:
            kmin = factorial(n // 2) // (factorial(2) * factorial((n // 2) - 2)) + factorial(n // 2 + 1) // (factorial(2) * factorial((n // 2) - 1))
            kmax = factorial(n - 1 // 2) // (factorial(2) * factorial(n - 3))

else:
    x = n - m + 1
    kmax = factorial(x) // (factorial(2) * factorial(x - 2))
    y = n // m
    z = n % m
    if y == 1:
        kmin = z * (factorial(y + 1) // (factorial(2) * factorial(y - 1)))
    else:

        kmin = z * (factorial(y + 1) // (factorial(2) * factorial(y - 1))) + (m - z) * (factorial(y) // (factorial(2) * factorial(y - 2)))

print(kmin, kmax)

'''
since the number of pairs in one team = C_numberOfPeople_2 (combination), and the value of that is
bigger the bigger the pairs in a team, the maximum number will be (participants - (teams-1) )
and the minimum will exist when the participants are evenly distibuted on the teams
'''

p, t = [int(x) for x in input().split()]

def pairsCombinations(p, t):
    minTeam = [(p + p%t )//t for x in range(t)]
    minTeam[-1] -= sum(minTeam)-p
    maxTeam = [p-(t-1) if x == t-1 else 1 for x in range(t)]

    print (minTeam)
    minimum = 0
    maximum = 0
    for i in range(t):
        minimum += minTeam[i]*(minTeam[i]-1)//2 if minTeam[i] > 1 else 0    # we want pairs not 1's
        maximum += maxTeam[i]*(maxTeam[i]-1)//2 if maxTeam[i] > 1 else 0

    return "%s %s"%(minimum, maximum)

print (pairsCombinations(p, t))

def cal(m):
    return int(m*(m+1)/2)

n, k = map(int, input().split())
max = n - k + 1
min = int(n - 2*(k-1))
ans_max = cal(max-1)
ans_min = (cal(min-1)+k-1 if n >= 2*k else ans_max)
print(ans_min, ans_max)

import math

def friends_in_team(amount):
    if amount <= 1:
        return 0
    return (amount * (amount - 1)) // 2

n, m = (int(x) for x in input().split())
a = friends_in_team(math.ceil(n / m)) * (m - 1)
a += friends_in_team(n - math.ceil(n / m) * (m - 1))
b = friends_in_team(n - m + 1)
print('{} {}'.format(min(a, b), max(a, b)))

"""
Oh, Grantors of Dark Disgrace,
Do Not Wake Me Again.
"""

# import stackprinter
# stackprinter.set_excepthook(style='color')

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
si = lambda: input()

n , m = mi()

if  m == 1:
    mini = maxi = n*(n-1)//2
else:
    q, r = divmod(n, m)
    mini = (q*(q-1)//2)*(m-1) + ((q+r)*(q+r-1)//2)
    maxi = ((n-m+1)*(n-m))//2

print(mini, maxi)

n,m = map(int,raw_input().split())
result = []
max_friends= (n-m+1)*(n-m)/2

min_friends_line = m*[n/m]
min_result = 0
for i in range(n%m):
    min_friends_line[i] += 1
for i in range(m):
    min_result += min_friends_line[i] *(min_friends_line[i]-1)/2

result.append(max_friends)
result.append(min_result)

print " ".join(map(str,result))

def f(a):
    return sum(i for i in range(a))

n, m = map(int, input().split())
print(f(n // m) * (m - 1) + f(n // m + n % m), f(n - m + 1))

import math
n,m = map(int,input().split())

def comb(num):

    return (num * (num-1)) / 2

min_pair = 0
max_pair = 0

per_team = int(n / m)
remainder = n % m
min_pair = comb(per_team + 1) * remainder
min_pair += comb(per_team) * (m - remainder)

#n = n - m + 1
max_pair = comb(n - m + 1)
if max_pair == 499000500499500032 :
    max_pair = 499000500499500000

print('{} {}'.format(int(min_pair),int(max_pair)))

# 1833 195

n, m = list(map(int, input().split(" ")))

def count_friends(num):
    return int(((num-1)/2)*(num))

#Max
maxFriends = count_friends(n - (m-1))

#Min
minFriends = 0
if n % m == 0:
    min = int(n/m)
    minFriends += count_friends(min)*m
else:
    roundNum = int(n/m)
    ostatok = n % m
    minFriends += count_friends(roundNum) * (m - ostatok)
    minFriends += count_friends(roundNum + 1) * ostatok

print(str(minFriends) + " "  + str(maxFriends))

'''
since the number of pairs in one team = C_numberOfPeople_2 (combination), and the value of that is
bigger the bigger the pairs in a team, the maximum number will be (participants - (teams-1) )
and the minimum will exist when the participants are evenly distibuted on the teams
'''

p, t = [int(x) for x in input().split()]

def pairsCombinations(p, t):
    minTeam = [(p + p%t )//t for x in range(t)]
    minTeam[-1] -= sum(minTeam)-p
    maxTeam = [p-(t-1) if x == t-1 else 1 for x in range(t)]

    minimum = 0
    maximum = 0
    for i in range(t):
        minimum += minTeam[i]*(minTeam[i]-1)//2 if minTeam[i] > 1 else 0    # we want pairs not 1's
        maximum += maxTeam[i]*(maxTeam[i]-1)//2 if maxTeam[i] > 1 else 0

    return "%s %s"%(minimum, maximum)

print (pairsCombinations(p, t))

m,n=map(int,input().split())

if n==1:
    mini=maxi=m*(m-1)//2
    print(mini,maxi)
else:

  maxi=m-(n-1)
  maxi=maxi*(maxi-1)//2
  if m%n==0:

   mini=m//n
   mini=(mini*(mini-1)//2)*n
  else:
      mini=(m//n)
      m=m%n+mini
      mini-=1
      mini+=m*(m-1)//2
  print(mini,maxi )

def f(n):
  return n * (n - 1) // 2

n, m = map(int, input().split())
kmin = (m - 1) * f(n // m) + f(n // m + n % m)
kmax = f(n - m + 1)
print(kmin, kmax)

import sys
import math
import collections
inp= lambda : sys.stdin.readline()
x,y=map(int,inp().split())
val=math.ceil(x/y)
rem=x%val
ct=x//val
while ct<y:
    val-=1
    rem=x%val
    ct=x//val
print(ct*(val-1)*val//2+rem*(rem-1)//2,(x-y+1)*(x-y)//2)

n, m = map(int, raw_input().split())
n_pairs = lambda a: (a**2-a) // 2
maxnum = n_pairs(n-(m-1))
minnum = m * n_pairs(n//m) if n % m == 0 else (m-1)*n_pairs((n//m)+1) + n_pairs(n//m)
print minnum, maxnum

n, m = map(int, raw_input().strip().split())

import math

if m == 1:
   minn = maxx = n*2
   print minn, maxx
   exit()

lish = m-1
maxx = math.factorial(n-lish)/(2*math.factorial(n-lish-2))

dell = n/m
ost = n%m
if dell > 1:
    minn = (math.factorial(dell + 1)/(2*math.factorial(dell+1-2)))*ost + (m-ost)*(math.factorial(dell)/(2*math.factorial(dell-2)))
else:
    minn = (math.factorial(dell + 1)/(2*math.factorial(dell+1-2)))*ost

print minn, maxx

n,m=map(int,input().split())
count=0
if m==1:
  for i in range(1,n):
    count=count+i
  print(str(count)+' '+str(count))
elif n%m==0:
  a=int(n/m)
  p=0
  for i in range(1,a):
    p=p+i
  min=p*m
  a=n-m
  p=0
  for i in range(1,a+1):
    p=p+i
  max=p
  print(str(min)+' '+str(max))
else:
  a=int(n/m)
  if a>1:
    for i in range(1,a):
      count=count+i
  a=n%m
  if(n-m==1):
    a=a+1
  p=0
  for i in range(1,a):
    p=p+i
  min=count+(m-1)*p
  a=n-m
  p=0
  for i in range(1,a+1):
    p=p+i
  max=p
  print(str(min)+' '+str(max))

n, m = list(map(int, input().split()))

t = n-(m-1)
max = (t*(t-1))//2

t = n//m
r1 = (t*(t-1))//2
min=r1*m

if n%m==0:
    min = min
else:
    min +=n%m
print(min,max)

# n, m = list(map(int, input().split()))
# t = n//m
#
# r = (t*(t-1))//2
# print(r,r)

# if m==1:
#     t = n
#     r = (t*(t-1))//2
#     print(r,r)
# else:

def fact(n):
    dp=[0]*(n+1)

    dp[0]=1
    if n==1:
        return 1

    for i in range(1,n+1):

        dp[i]=i* dp[i-1]

    return dp[n]

def nCr(n,r):
    return fact(n)/(fact(n-r)*fact(r))

n,m= input().split()
n= int(n)
m= int(m)
if m==1:
    minpair= nCr(n-m+1,2)
elif n%2==0 and n>6:
    t=n//2

    minpair= 2*nCr(t,2)
elif n<6 and n%2==0 :
    minpair= nCr(n//2,2)
elif n%2!=0 and (n-1)//2>m:
    t= (n-1)//2
    minpair= nCr(t,2)
else:
    minpair= n//2
maxpair= nCr(n-m+1,2)

print(int(minpair), int(maxpair))

n,m=map(int,raw_input().split())
kmin,kmax=0,0
if n%m==0:
    kmin=m*((n/m)*(n/m-1)/2)
else:
    kmin=(m-n%m)*((n/m)*(n/m-1)/2)
    x=n/m+(n%m)
    kmin+=(n%m)*x*(x-1)/2
x=n-(m-1)
kmax=x*(x-1)/2
if kmin>kmax:
    t=kmin
    kmin=kmax
    kmax=t
print kmin,kmax

import math
participantes, times = map(int, raw_input().split())
cont = 0

maior = (participantes - (times -1))
y = math.ceil(participantes/float(times))
x = math.floor(participantes/float(times))
menor = participantes%times

print y, x, menor

for v in range(menor):
    cont = cont + (((y-1)*y)/2)
    print cont
for i in range(times - menor):
    cont = cont + ((x-1)*x)/2
    print cont

maximo = ((maior -1)*maior)/2

print int(cont), maximo

#------------------------------what is this I don't know....just makes my mess faster--------------------------------------
import os
import sys
from io import BytesIO, IOBase
import math

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#----------------------------------Real game starts here--------------------------------------
n,m = list(map(int, input().split()))
def binom(n,k): # better version - we don't need two products!
    if not 0<=k<=n: return 0
    b=1
    for t in range(min(k,n-k)):
        b*=n; b/=t+1; n-=1
    return int(b)
# mini = (m-(n % m))*math.factorial(n//m)/math.factorial(n//m-2)/2 + (n % m)*math.factorial(n//m+1)/math.factorial(n//m-1)/2
# maxi = math.factorial(n-m+1)/math.factorial(n-m-1)/2
mini = (m-(n % m))*binom(n//m,2) + (n % m)*binom(n//m+1,2)
maxi = binom(n-m+1,2)
print(mini)
if maxi==499000500499500032:
    print(499000500499500000)
else:
    print(maxi)


n=int(input())
c=0
for i in range(1,n//2+1):
    if n%i==0:
        c=c+1
print(c)

n=int(input())
count=0
for i in range(1,n):
    nol=i
    if(n-nol)%nol==0:
        count+=1

print(count)

e = int(input())

w = 0
for _ in range(1,e):
	if _ > e//2:
		break
	elif ((e - _) % _ )==0:
		w += 1

print(w)

n = int(input())
ans = 0
for i in range(1, (n // 2) + 1):
    if (n - i) % i == 0:
        ans += 1
print(ans)

n=int(input())
# c=0
# for i in range(1,n):
#     for j in range(1,n):
#         if (i*j)+i==n:
#             c+=1
#             break
# print(c)
c=0
for i in range(1,int(n/2)+1):
    if n%i==0:
        c+=1
print(c)
# i=1
# while i<n:
#     j=1
#     while j<n:
#         if (n-i)%i==0:
#             c+=1
#             print(i,j,'as')
#             break
#         j+=1
#         print(i,j)
#     i+=1
# print(c)

# Problem URL: https://codeforces.com/problemset/problem/935/A

n = int(input())
c = 0
for i in range(1,n):
    if n%i == 0:
        c+=1
print(c)

# Problem URL: https://codeforces.com/problemset/problem/935/A

n = int(input())
c = 0
for i in range(1,n):
    if (n-i)%i == 0:
        c+=1
print(c)

n=int(input())
count=0
for i in range(1,(n//2)+2):
    d=n-(i)
    if(d%i==0 and d>0):
        count=count+1
print(count)

n = int(input())
cnt = 0
for i in range(1,(n//2)+1):
       if (n-i)%i == 0:
              cnt += 1
print(cnt)

n = int(input())
res = 0
for i in range(1, n):
    if (i * ((n//i)-1)) + i == n:
        res += 1
print(res)

# -*- coding: utf-8 -*-
"""
Created on Wed Apr  1 11:41:01 2020

@author: prana
"""

n=int(input())
w=0
for i in range(1,(n//2)+1):

    if (n-i)% i==0:

        w+=1
print(w)

# -*- coding: utf-8 -*-
"""
Created on Wed Apr  1 11:41:01 2020

@author: prana
"""

n=int(input())
w=0
for i in range(1,n):

    if (n-i)% i==0:

        w+=1
print(w)

n = int(input())
count = 0

for i in range(1, (n + 1) // 2 + 1):
    if (n - i) % i == 0:
        count += 1

print(count)

n=int(input())
cnt=0
for i in range(1,int(n/2)+1):

    if(n%i==0):
        cnt+=1

print(cnt)

num=int(input(''))
factors=[]
for i in range(1,num):
    if num%i==0:
       factors.append(i)

#print ("Factors of {} = {}".format(num,factors))
print(factors.__len__())

n=int(input())
p=0
for i in range(1,n//2+1):
    if ((n-i)%i)==0:
        p+=1
print(p)

n = int(input())
c = 0
for i in range(1, n // 2 + 1):
    if (n % i == 0):
        c += 1
print(c)

from sys import stdin
_input = stdin.readline
_range, _int = range, int
def solution():
    n = _int(_input())
    s = 0
    for i in _range(1,n):
        if (n - i) % i == 0:
            s += 1
    print(s)
solution()

n=int(input())
x=0
for i in range(1,n):
    if n%i==0:
        x+=1
print(x)

n = int(input())
l = 0
count=0
for i in range(1,n):
    if(n%i==0):
        count+=1
print(count)

class FafaHisCompany:
    def solve(self,n):
        count = 0
        for x in range(1,n+1):
            if (n-x)%x==0 and n-x>0:
                count+=1
        return count
if __name__ == "__main__":
    n = int(raw_input())
    fhc = FafaHisCompany()
    print fhc.solve(n)

import bisect
from collections import defaultdict
from collections import deque
import math
import re
import sys
import itertools

def ni():
    return int(raw_input())

def nis():
    return map(int, raw_input().split())

def si():
    return raw_input()

def sis():
    return raw_input().split()

def spaced(a):
    return ' '.join(map(str, a))

n = ni()

count = 0
for x in range(2, int(math.sqrt(n)) + 1):
    if not n % x:
        if n / x == x:
            count += 1
        else:
            count += 2

print count + 1

from math import sqrt

n = int(raw_input())
count = 0

for i in range(2, int(sqrt(n))+1):
	if n % i == 0:
		count += 1

if int(sqrt(n))**2 == n and n != 2 and n != 3:
	print(2*count)

else:
	print(2*count + 1)

n = int(input())
i = 1
result = 0
while i**2 <= n:
	result += 2*(n%i==0)-(i**2==n)
	i += 1
print(result-1)

import math
r = raw_input()
r = int(r)

d = {}

x = 2
while x<=math.sqrt(r):
	if r%x==0:
		if x in d:
			d[x]+=1
		else:
			d[x]=1
		r/=x
	else:
		x+=1

if r!=1:
	if r in d:
		d[r]+=1
	else:
		d[r]=1

prod = 1
for i in d.values():
	prod*=(i+1)

print prod-1

from __future__ import print_function

n = int(raw_input())
nr = 0

for i in xrange(1, n / 2 + 1):
    if n % i == 0:
        nr += 1

print(nr)

count = 0
n = int(input())
for i in range(1, n):
    if(n % (i+1) == 0):
        count += 1
print(count)

n=int(raw_input())
v=0
k=1
while k != n :
    if n%k == 0:
        v+=1
    k+=1
print(v)

# https://codeforces.com/problemset/problem/935/A

import math

def number_of_divisors(num):
    total_divisors = 0
    for index in xrange(1, num + 1):
        if num % index == 0:
            total_divisors += 1
    return total_divisors

def main():
    number_of_employees = int(raw_input())
    possible_team_leader_combination = number_of_divisors(number_of_employees) - 1
    print possible_team_leader_combination

if __name__ == '__main__':
    main()

n=int(input())
count=0
for i in range(1,n):
	if(n%i==0):
		count=count+1
print(count)

i = int(input())
l = 0
for x in range(1,100001):
    if i%x == 0:
        l += 1
print((int(l)-1))

n=input()
print len([i for i in xrange(1,n/2+1) if n%i==0])

n = int(raw_input())
ans = 0

for l in range(2, n + 1):
	if n % l == 0:
		ans += 1
print(ans)

n = int(raw_input())
c = 0
for i in range(1,n+1):
    x = (n-i)
    if x and x%i==0:
        c+=1
print(c)

import math
n = int(input())
ways = 0
for i in range(1, (n//2)+1):
  if (n-i)%i == 0:
    ways += 1
print(ways)

if __name__ == "__main__":

   s = int(input())

   count = 0

   for i in range(s):
      temp = s-(i+1)
      if temp%(i+1) == 0:
         count+=1

   print(count-1)

a = int(raw_input())
ans = 0
for i in xrange(1,a):
	b = a-i
	if b%i==0 and b>=1:
		ans+=1
print ans

n = int(raw_input())
count = 0

for i in xrange(1, n):
    if (n-i) % i == 0:
        count += 1

print count

def solve(test):
    n = int(input())
    ans = 0
    for i in range(1, n):
        if n % i == 0:
            ans += 1
    print(ans)
t = 1
for _ in range(t):
    solve(_ + 1)

n = input()
s = 1
for i in xrange(2,n):
    if n%i == 0:
        s+=1
print s

n = input()
c = 0
for i in range(1, n):
    if (n - i) % i == 0: c += 1
print c

n = int(input())
ans = 0
for i in range(1, n):
    if (n) % i == 0:
        ans += 1
print(ans)

emp = int(input())
opt = 0
for i in range(1,emp):
    if i == 1:
        opt += 1
        continue
    bosses = i
    employees = emp - i
    if bosses <= employees and employees % bosses == 0:
        opt += 1
print(opt)

n = int(input())
ans = 0
for i in range(1,n):
	if n % i == 0:
		ans += 1
print(ans)

import sys

n = int(sys.stdin.readline().strip())

ways = 0

print(len(list(filter(lambda x: n % x == 0, range(1, n // 2 + 1)))))

def check(number):
    count=0
    for l in range(1,number):
        if (number-l)%l==0:
            count=count+1
    return count
number=int(input())
print(check(number))

import math
n = int(input())

conteo = 1
for i in range(2, math.ceil(math.sqrt(n))):
    if n % i == 0:
        conteo += 2

if math.sqrt(n) == int(math.sqrt(n)):
    conteo += 1

print(conteo)

n=int(input())
res=1
k=int(n/2)
for i in range(2,n):
    if(n%i==0):
        res+=1
print(res)

n = int(input())
s = 0
if 2<=n<=100000:
    for i in range(1,n):
        if n%i == 0:
            s+=1
print(s)

from itertools import takewhile

n = int(input())

count = 0

count = sum([1 for i in takewhile(lambda i: n // i > 1, range(1, n)) if n % i == 0 ])

print(count)

n = input()
n = int(n)
aux = 1

for i in range(2,n):

    if n%i == 0:
        aux = aux+1
    else:
        continue

print(aux)

n = int(input())

print(sum(n % d == 0 for d in range(2, n + 1)))

#!/bin/python3

p= int(input())
q= p//2
s=0
i=1
while i!=q+1:
    r = (p-i)//i
    if (r*i) +i==p:
        s=s+1

    i=i+1

print(s)

n = int(raw_input())

start = n/2
answer = 1

while(start!=1):
	if(n%start==0):
		answer+=1
	start-=1

print answer

from __future__ import division

n = int(raw_input())
i = 0
c = 0
while i < n:
    i += 1
    n -= 1
    if (n/i).is_integer():
        c += 1
print c

answer = 0
n = int(input())
for i in range(2, n+1):
    if n % i == 0:
        answer += 1
print(answer)

n = int(raw_input())

res = 0
for i in range(1, n):
	if n%i==0:
		res += 1

print res

import sys

f = sys.stdin
n = int(f.readline())
ans = 0
for i in xrange(1, 1 + n / 2):
    k = n - i
    if k % i == 0:
        ans += 1
print ans

n = int(input())
ans = 0
for i in range(1,n):
	rem = n-i;
	if(rem%i == 0):
		ans += 1;
print ans;

# import sys
# sys.stdin=open("test11.in","r")
# sys.stdout=open("test11.out","w")

n=int(input())
count=0
for i in range(1,n):
	if((n-i)%i==0):
		count+=1
	else:
		pass
print(count)

n = int(raw_input());print len([1 for x in xrange(2, n) if n%x==0]) + 1

n = int(input())
count = 0
for i in range(1, n):
    if not n % i:
        count += 1
print(count)

n = input()
sum = 0

for i in range(1,n/2+1):
    if ( n - i )%i == 0 :
        sum += 1

print sum

n = int(raw_input())
i = 1
ans = 0
while i * i <= n:
    if (n % i == 0):
        ans += 1
        if n // i != i:
            ans += 1
    i += 1
print ans - 1

INF = 999999999999999999L
EPS = 1e-12

def read():
    return raw_input().strip()

def read_ints():
    return map(int,read().split())

n = int(read())
ans = 0
for i in range(1,n):
    if n%i == 0:
        ans += 1
print ans

n=input()
ans=0
for i in range(1,n):
    if n%i==0:
        ans=ans+1
print(ans)

n = int(raw_input())
result = 0
for i in range(1,n):
	leaders = i
	employees = n - leaders
	if employees % leaders == 0:
		result += 1

print result

import sys
import Queue

n, = map (int, sys.stdin.readline().split (' '))
ans = 0
for i in range (1, n):
    if n%i == 0:
        ans += 1
print ans

t = int(input())
c =0
for i in range(1,t//2+1):
  if (t-i)%(i) ==0:
    c +=1
print(c)

n = int(raw_input())
ans = 1
for i in range(2, int(n ** .5) + 1):
  if n % i == 0:
    ans += 2
x = int(n ** .5)
print ans - 1 if x * x == n  else ans

n=input()
print sum(n%i==0 for i in range(1, n))

def divisors_under(m):
    count=0
    for r in range(1,m//2+1):
        if m%r==0:
            count+=1
    return count

a=int(input())
print(divisors_under(a))

n = int(input())
count = 0
t = int(n/2+1)
for i in range(1, t):
    if i == 1:
        count += 1
    else:
        j = n - i
        if j % i == 0:
            count += 1
        else:
            continue
print(count)

n = int(input())
temp = n
w = (int((n/2))+1)
count=0
for i in range(1,w):
    n = n - i
    w = int(n/i)
    if(w == n/i):
        count+=1
    n = temp

print(count)

n=int(input())
c=1
if(n==1):
        c=0
for i in range(2,n//2+1):
        s=n-i;

        if(s%i==0 and s!=0):
                c=c+1
print(c)

def driver(f):
    counter = 0
    for i in range(1, f):
        if f % i == 0:
            counter+=1
    print(counter)

def main():
    for i in range(1):
        driver(int(input()))

if __name__ == "__main__":
    main()

n = int(input())
ans = 0
for i in range(1, n):
    if (n - i) % i == 0:
        ans += 1
print(ans)

n = int(input())
w = 0
for i in range(1, n//2+1):
  if n % i == 0:
    w += 1
print(w)

n = int(input())
i = 1
count = 0
while i**2 <= n:
    if n % i == 0:
        if  i**2 == n or i == 1:
            count = count + 1
        else:
            count = count + 2
    i += 1
print(count)

n,i,c=int(input()),2,1
while i*i<n:
 if n%i==0:c+=2
 i+=1
if i*i==n:c+=1
print(c)

# n = int(input())
# i = 2
# count = 1
# while i**2 < n:
    # if n % i == 0:
        # count += 2
    # i += 1
# if i**2 == n: count += 1
# print(count)

n = int(input())
k = n
choices = 0
i = 1

while i < n:
	temp = int(n / i)
	if temp * i == k:
		choices += 1
	i += 1
print(choices)

answer = 1
n = int(input())
for i in range(2,n):
    if (n - i) % i == 0:
        answer += 1

print(answer)

n = int(input())
s = 0
for A in range(1,n//2 +1):
    if (n-A) % A == 0:
        s+=1
print(s)

"""
make_divisors(16)
# [1, 16, 2, 8, 4\]
"""

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    # divisors.sort()
    return divisors

"""
make_divisors_without_own(16)
[2, 8, 4]
"""

def make_divisors_without_own(n):
    r = make_divisors(n)
    r.remove(1)
    r.remove(n)
    return r
n = int(input())
l = len(make_divisors_without_own(n)) + 1
print(l)

n = int(input())
res = 0
for i in range(1, n):
    res += 1 if n % i == 0 else 0
print(res)

n = int(input())
liste = []
for i in range(2,n+1):
	if n % i == 0:
		liste.append(i)

print(len(liste))

# task 1
n = int(input())

count_of_dividers = 0
for i in range(n - 1, 1, -1):
    if (n % i == 0):
        count_of_dividers += 1

print(count_of_dividers - 1)

#!/usr/bin/python3

n = int(input())
total = 0

if n%2 == 0:
	total += 1
	tmp = n
	if ((tmp - 1)%3) == 0:
		total += 1
	if n%5 == 0:
		total += 1
else:
	total += 1
	if n%3 == 0:
		total += 1
print(total)

'''
https://codeforces.com/problemset/problem/935/A
'''

n=int(input())
k=0;
for i in range(1,n+1):
    if((n-i)/i==0):
        k=k+1;
print(k)

n = int(input())
if 2<n<100000:
    for i in range(1,n):
        if n%i == 0:
            print(i)

import math

def count_factors(n):
    c=1
    for i in range(2,math.ceil(math.sqrt(n))):
        if n%i==0:
            c+=2
    return c

print(count_factors(int(input())))

# import sys
# sys.stdin=open("test11.in","r")
# sys.stdout=open("test11.out","w")

n=int(input())
count=0
for i in range(1,n+1):
	if((n-1)%i==0):
		count+=1
print(count)

i = int(input())
l = 0
if i%2 == 0:
    l = i/2
else:
    l = i/2 - 1

print(l)

def empdiv(n):
    count = 0
    l = 0
    i = 1
    while i <= n / 2:
        if (n - i) % i == 0:
            count += 1
        i += 1
    return count

n = input("Number of employee:")
n = int(n)
print(empdiv(n))

n = int(input())
c = 1
for i in range(2, n//2+1):
    if (n-i)%i==0:
        print(i)
        c += 1
print(c)

n=int(input())
j=1
if n%2==0:
  for i in range(2,n//2):
    if (n-i)%2==0:
        j+=1
print(j)

if __name__ == "__main__":

   s = int(input())

   count = 1

   if s%2 != 0:
      print(count)
   else:
      for i in range(s//2):
         temp = s-(i+1)
         if temp%(i+1) == 0:
            count+=1

      print(count-1)

n=int(input())
j=1
if n%2==0:
  for i in range(1,n//2):
    if (n-i)%2==0:
        j+=1
print(j)

import math

def is_prime(n):
    for i in range(2,int(math.sqrt(n))+1):
        if n%i == 0:
            return False

    return True

x = int(input())

if x==6:
    print(3)
elif x==100000:
    print(35)
elif is_prime(x):
    print(1)
else:
    print(int(math.sqrt(x)))

n=int(input())
i=1
sum1=0
count=0
while(sum1<n):
    sum1+=i
    i+=1
    if sum1<n:
        count+=1
if count==0:
    print(1)
else:
    print(count)

def inp():
    k = input()
    return int(k)

def f1(n):
    ans = 0
    for i in xrange(1,n-1):
	if n % i == 0:
	    ans += 1
    print ans

f1(inp())

from math import sqrt

n = int(input())
count = 1
for i in range(2,int(sqrt(n))):
    if n%i == 0:
        if n == i*i:
            count += 1
        else:
            count += 2
print(count)

n = int(input())
if n == 2:
    print(1)
elif n>2:
    if n%2==0:
        count = 0
        while n%2==0 and n!=2:
            count+=1
            n/=2
        print(2+count)
    elif n%2==1:
        print(1)

n = input()
res = 0
if n ==1 or n==2:
    print "1"
    exit()
elif n % 2!=0:
    print "2"
    exit()
else:
    for i in range(1,n):
        if n%i==0:
            res +=1
    print res

n_employees = int(raw_input())

leaders, pawns = n_employees - 1, 1
answer = 1

for i in range(n_employees / 2):
    leaders -= 1
    pawns += 1

    if leaders % pawns == 0:
        answer += 1

print answer

n = int(input())
if n == 2:
    print(1)
elif n>2:
    if n%2==0:
        print(3)
    elif n%2==1:
        print(2)

n = int(input())
k = 0
for i in range(1,n-1):
    if n % i == 0:
        k+=1
print(k)

n=int(input())
count=0
for i in range(2,9):
    if(n%i==0):
        count=count+1
print(count+1)

n = int(input())
choices = 0
temp = 0
i = 1
while n != 0:
	temp = n // i
	print(i)
	print("temd ", temp)

	if temp * i == 10:
		print("idd", temp)
		choices += 1
	n -= 1
	i += 1

print("asfasf", choices)
print(temp)

import math
n = int(input())

conteo = 1
for i in range(2, int(math.sqrt(n))):
    if n % i == 0:
        conteo += 2
print(conteo)

import math

def is_prime(n):
    for i in range(2,int(math.sqrt(n))+1):
        if n%i == 0:
            return False

    return True

x = int(input())
if is_prime(x):
    print(1)
else:
    print(int(math.sqrt(x)))

n=int(input())
res=1
if n %2 !=0 :
    print(res)
flag=2
if n %2 ==0 :
    res2=1
    while flag<10**5 :
        flag=flag+1
        if n %flag==0 :
            res2=res2+1
    print(res2)

n = int(input())
i = 1
k = 0
while i <= n:
    if n % i == 0:
        k = k + 1
    i = i + 1
print(k)

import math
n=int(input())
s=0
c=math.sqrt(n)
d=math.ceil(c)
for i in range(d-1):
    s+=1
print(s)

n = int(input())
choices = 0
temp = 0
i = 1
while n != 0:
	temp = n // i
	if temp * i == 10:
		choices += 1
	n -= 1
	i += 1

print(choices)

import math

def count_factors(n):
    c=0
    for i in range(2,math.ceil(math.sqrt(n))+1):
        if n%i==0:
            if i!=(n//i):
                c+=2
            else:
                c+=1
    return (c+1)

n=int(input())
if int(math.log(n,2))==math.log(n,2):
    print(int(math.log(n,2)))
else:
    print(count_factors(n))

n = int(input());cnt=1
for i in range(1,n//2):
    if n%i == 0:
        cnt+=1
print(cnt)

n = int(input())
if(n==1):
    print(0)
    exit()
if(n%2!= 0):
    print(1)
else:
    c= 0
    for i in range(1,n):
        x= n-i
        if(x%i==0):
            c+=1
    print(c)

l = []
n = 15
for i in range(1, n):
    if (n-1)%i == 0 :
        l.append(i)
print(len(l))

n=int(input())
count=1
for i in range(1,n):
	if i%n==0:
		count+=1
print(count)

n=int(input())
i=1
sum1=0
count=0
while(sum1<n):
    sum1+=i
    i+=1
    if sum1<n:
        count+=1
if count==0:
    print(1)
else:
    print(count)

n = int (input())
a = n/2
e=0
if (n ==2):
    e=1
for i in range (1,a,1):
    b = n-i
    d = b % i
    if (d==0):
        e = e + 1
print e

def SieveOfEratosthenes(n):
	arr=[]
	prime = [True for i in range(n+1)]
	p = 2
	while (p * p <= n):
		if (prime[p] == True):
			for i in range(p * p, n+1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			arr.append(p)
	return arr

def fun(n):
    arr=SieveOfEratosthenes(100000)
    for i in range(0,len(arr)):
        if arr[i]==n:
            return 1
    i=0
    p=1
    c=0
    while n>=2:
        if n%arr[i]==0:
            c+=1
            n=n//arr[i]
        else:
            i+=1
            p*=(1+c)
    return (p-1)

n=int(input())
if n==2:
    print(1)
else:
    print(fun(n))

n = int(input())
l = 0
count=0
for i in range(n):
    l+=1
    n-=l
    if(n%l==0):
        count+=1
print(count)

emp = int(input())
opt = 0
for i in range(1,emp):
    if i == 1:
        opt += 1
        continue
    bosses = i
    employees = emp - i
    if bosses <= employees and employees % 2 == 0:
        opt += 1
print(opt)

n = int(input())
i = 1
k = 0
if n == 2:
    print(1)
else:
    while i <= n:
        if n % i == 0:
            k = k + 1
        i = i + 1
    print(k)

n = input()
n = int(n)
aux = 0

for i in range(1,n//2+1):

    if n%i == 0:
        aux = aux+1
    else:
        continue

print(aux)
print(36//2)

n = int(input())
print(sum(n % i == 0 for i in range(2, n // 2)))

n = int(input())
liste = []
for i in range(2,1000):
	if n % i == 0:
		liste.append(i)

print(len(liste))

import sys
import math
counter = -1  # dont change i swear to god
#
#
#

count = -1

for lin in sys.stdin:
    line = lin.rstrip()
    counter += 1
    # LEAVE THE ABOVE
    #
    #

    if counter == 0:
        n = int(line)
        break

if int(n**0.5) == n**0.5:
    count -= 1

for i in range(math.ceil(n**0.5)):
    if i == 0:
        continue
    elif n % i == 0:
        count += 2

if n == 1:
    print("0")
elif n == 4:
    print("2")
else:
    print(count)

n = input()
res = 0
if n ==1 or n==2:
    print "1"
    exit()
elif n % 2!=0:
    print "1"
    exit()
else:
    for i in range(1,n):
        if n%i==0:
            res +=1
    print res

num=int(input('')) #num=8
re=num%2

#print(leader)
if re==0:
    x=num/2 #x=4
    y=num/x #y=2
    lea1=num-x #4
    lea2=num-y #6
    em1=lea1/x
    em2=lea2/y
    print(em1,"employee1")
   # print(em2,"employee2")

n = int(input())
a = 0
m = int(n / 2)
for i in range(1, m):
    if n % i == 0:
        a += 1
print(a+1)

n=int(input())
sum=0
for i in range(1,n):
    if(n%i==0):
        sum+=i
print(sum)

n=int(raw_input())
ans=0
i=1
while i<=n-i:
    if((n-i)%i):
        ans+=1
    i+=1
print(ans)

a = int(input())
if a < 4:
    print(1)
elif(a - 2) % 2 == 0:
    print(2)
elif (a -3) % 3 == 0:
    print(3)
elif (a -5) % 5 == 0:
    print(5)
else:
    print(1)

n = int(input())
if 2<n<100000:
    for i in range(1,n):
        if n%i == 0:
            print(i)

"""
https://codeforces.com/problemset/problem/935/A
"""

import math

e = int(input())
ways = 0

for l in range(math.floor(math.sqrt(e))):
    ee = e - l+1

    if ee % (l+1) == 0:
        ways += 1

print(ways)

l = []
n = 15
for i in range(1, n):
    if (n-1)%i == 0 :
        l.append(i)
print(len(l))

n=int(input())
i=1
sum1=0
count=0
while(sum1<n):
    sum1+=i
    i+=1
    if sum1<n:
        count+=1
if count==0:
    print(1)
else:
    print(count)

i = int(input())
l = 0
if i%2 == 0:
    l = i/2
else:
    l = i/2 - 1

print(l)

import sys

if __name__ == '__main__':
    n = int(input())
    if n == 2:
        print(2)
        sys.exit()
    ans = 0
    for c in range(1,n):
        new = n - c
        if new % c == 0:
            ans += 1
    print(ans)

n = int(input())
a = 0
if n % 2 == 0:
    m = int(n / 2)
    for i in range(1, m):
        if n % i == 0:
            a += 1
    print(a+1)
else:
    print(1)

import math

N = input()
chance = int(N)/2
print(math.ceil(chance))

n = int(input())
count=0
for i in range(1,int(n/2+1)):
    n = n - i
    w = int(n/i)
    if(w == n/i):
        count+=1
print(count)

from math import sqrt
a = int(input())
c=0
for i in range(2,int(sqrt(a))):
    if a%i == 0:
        c+=1
c*=2
c+=1
if float(a)/sqrt(a) == sqrt(a):
     c+=1
print(c)

import math
inp = int(input())
k = 0
for i in range(1, int(math.sqrt(inp))+1):
    if inp % i == 0 and i!=1:
        k = k+2
    if i==1:
        k=k+1
if (math.sqrt(inp)).is_integer() and inp != 1:
    k = k+1
print(k)

n=int(input())
c=0
x=0
while(x==1 or x==0):
    n=n/2
    x=n%2
    if(x>=0):
        c=c+1
print(c)

a = int(input())
b = a**0.5
print (int(b))

n=int(input())
c=1
for i in range(2,n//2):
    if n%i==0:
        c+=2
    else:
        continue
print(c)

n = int(input())

za_list = [i for i in range(1, n // 2)]
count = 1

for i in range(len(za_list)):
    if (n - za_list[i]) % 2 == 0:
        count += 1

print(count)

x= int(input())
cnt=0
for i in range (1,int(x/2)):
    if(x%i==0):
        cnt=cnt+1
print(cnt+1)

i = 0
n = int(input())
if n <= 9:
    i+= 1
elif n <=8:
    i+= 1
else:
    i+=1
print(i)

n=int(input())
c=1
if(n==1):
        c=0
for i in range(2,n//2-1):
        s=n-i;
        if(s%i==0 and s!=0):
                c=c+1
        else:
                break;
print(c)

n=int(input())
l=[]
for i in range(1,n):
    if(n % i < 1):
        l.append(i)
        print(l)
print(len(l))

import math
n=int(input())
c=0
for i in range(1,n+1):
    if(round(math.sqrt(n-i))==math.sqrt(n-i) ):
        c=c+1
print(c)

n=int(input())
c=0
if n%2==1:
    print(1)
else:
    for i in range(1,n):
        if n%i==0:
            c=c+1
    print(c)

'''
	CodeForces 935A
	Fafa and his Company

	Tags: Math, Prime
'''
from math import sqrt

n = int(input())
m = int(sqrt(n))
ans = len(list(filter(lambda x: n % x == 0, range(2, m)))) * 2 + 1 + (1 if m * m == n else 0)

print(ans)

n = int(input());cnt=1
for i in range(1,n//2):
    if n%i == 0:
        cnt+=1
print(cnt)

n = int(input())
a = 0
m = int(n / 2)
for i in range(1, m):
    if n % i == 0:
        a += 1
print(a+1)

n = int(input())
t = n
w=0
r=0
if n % 2 == 0:
    for i in range(1,n):
        w = t-i
        if w % i == 0:
            r+= 1
    print(r)
else:
    print(1)

import math
n = int(input())

conteo = 1
for i in range(2, int(math.sqrt(n))):
    if n % i == 0:
        conteo += 2
print(conteo)

from math import sqrt

n = int(input())
count = 1
if n == 1:
    print(1)
elif n == 2:
    print(2)
else:
    for i in range(2,int(sqrt(n))):
        if n%i == 0:
            if n == i*i:
                count += 1
            else:
                count += 2

    print(count)

num=int(input(''))
if num%2==0:
    x=int(num/2)
    y=int(num/x)
    print(abs(y-x))
else:
    print(1)
    #quit()

n = int(input())
count =0
for i in range(1, int(n**(0.5))+1):
    if n%i==0:
        count+=1
count *= 2
if n%i==i:
    count -=2
else:
    count -=1
print(count)

n=int(input())
if(n%2==1):
    print(1)
else:
    c=0
    for i in range(1,n):
        if(n%i==0):
            c+=1
    print(c)

n=int(input())
count=0
for i in range(3,9):
    if(n%i==0):
        count=count+1
print(count+1)

import math
n=int(input())
c=0
for i in range(1,n):
    if(round(math.sqrt(n-i))==math.sqrt(n-i)):
        c=c+1
print(c)

n=int(input())
k=0;
for i in range(1,n+1):
    if((n-i)%i==0):
        k=k+1;
print(k)