import math


def diff_payments(P, n, i):
    """Finding the differentiated payment using:
    P = credit principal
    n = number of payments (months)
    i = nominal (monthly) interest rate (float, not a percentage)
    Returns formatted string

    A differentiated payment schedule is where part of the payment reduces the credit principal is constant.
    """
    P = int(P)
    n = int(n)
    i = float(i) / (100 * 12)
    subtotal = 0
    res = ''
    for m in range(1, n + 1):
        D_m = math.ceil((P / n) + i * (P - (P * (m - 1) / n)))
        res = res + f'Month {m}: payment is {D_m}\n'
        subtotal += D_m

    overpayment = subtotal - P
    string_overpayment = f'\nOverpayment = {overpayment}'
    res = res + string_overpayment
    return res