def dist(a, b, c)
  (a + c - b) % a < (a + b - c) % a ? (a + c - b) % a : (a + b - c) % a
end

a, b, c = gets.split.map(&:to_i)
d = 0
min_distance = nil

stations = []

while d < b
  stations << gets.to_i
  d += 1
end

stations.permutation(stations.size) do |stations|
  current_station = c
  distance = 0
  stations.each do | nest_station |
    distance += dist a, current_station, nest_station
    current_station = nest_station
  end
  min_distance = distance if min_distance.nil? || min_distance > distance
end

puts min_distance * 100