def avg_running(old_est, n_th_sample, n):
    """
    Calculates the running average.

    :param old_est: Previous value of the average.
    :param n_th_sample: New value to be included in the average.
    :param n: Overall number of samples.
    :return: Average including the new value.
    :rtype: float
    """
    assert(n > 0)
    return 1/n * n_th_sample + (n-1)/n * old_est