A taxi ride costs $40 for the first 500 meters, and each additional 300 meters (or a fraction thereof) adds $3.50 to the fare. Use a piecewise function to represent the taxi fare in terms of the distance d in meters.