#!/usr/bin/env python3
from math import hypot
from sys import exit

d = float(input())
assert 1 <= d <= 1000, 'D must be between 1 and 1000'

n = int(input())
assert 2 <= n <= 1000000, 'N must be between 2 and 1000000'

v = []
for i in range(n):
  x, y = map(int, input().split())
  v += [(x, y)]

total = 0.0
for i in range(1,n):
  assert v[i] != v[i-1], 'Two points are repeated'
  total += hypot(v[i][0]-v[i-1][0], v[i][1]-v[i-1][1])

assert total >= d, 'Insufficiently long path'
exit(42)
