def get_cost_influence(did_we_trade, amount_influence, current_influence):
    """
    returns how much it costs to buy amount_influence if did_we_trade and have current_influence
    """
    if amount_influence == 0:
        return 0
    cost = 0
    if did_we_trade:
        cost = cost + 1
        amount_influence = amount_influence - 1
        current_influence = current_influence + 1

    return cost + (2*current_influence + amount_influence + 1)*amount_influence/2