def accMFC(velocity, driver_style, desired_velocity, acc_p_curve):
    """
    Calculate the MFC free flow acceleration.

    :param velocity:
        speed. (m/s)
    :type velocity: int

    :param driver_style:
        Driver style from 0-1.
    :type driver_style: int

    :param desired_velocity:
        desired velocity (m/s)
    :type desired_velocity: int

    :param acc_p_curve:
        Speed acceleration curve of the gear in use.
    :type acc_p_curve:

    :return:
    """
    if velocity / desired_velocity > 0.5:
        if desired_velocity > velocity:
            on_off = 1 - pow(velocity / desired_velocity, 60)
        else:
            on_off = 10 * (1 - velocity / desired_velocity)
    else:
        on_off = 1 - 0.8 * pow(1 - velocity / desired_velocity, 60)
    acc = acc_p_curve(velocity) * driver_style * on_off
    return acc
