def function(road, damage_ratio):
    length = road['length']

    print("Computing damage for replacement of %s" % road)

    surface_type = road['surface_type']
    if surface_type == 'gravel':
      return damage_ratio * length * 100
    elif surface_type == 'asphalt':
      return damage_ratio * length * 300
    else:
      return damage_ratio * length * 100
