def calc_num_subsegments(n, m):
    """Calculates the number of possible subsegments for the chain of length n
    and minimum subsegment length m.
    """
    m = m - 1
    return (n*(n+1))/2 - (m*n - (m*(m+1))/2 + m)