func_code_string: #include <bits/stdc++.h>   using namespace std;   void solutionA();   int main() {     ios_base::sync_with_stdio(false);     solutionA();     return EXIT_SUCCESS;   }   long long n, a, b, u[1024];   double d[1024];   struct point {     double x, y;     point(double x = 0, double y = 0) : x(x), y(y) {}   } s, f;   struct segment {     point p1, p2;   } t[1024];   point operator+(const point& p1, const point& p2) {     return point(p1.x + p2.x, p1.y + p2.y);   }   point operator-(const point& p1, const point& p2) {     return point(p1.x - p2.x, p1.y - p2.y);   }   istream& operator>>(istream& in, point& p) {     in >> p.x >> p.y;     return in;   }   ostream& operator<<(ostream& out, point& p) {     out <<  (  << p.x <<  ,   << p.y <<  ) ;     return out;   }   double dot(const point& p1, const point& p2) {     return p1.x * p2.x + p1.y * p2.y;   }   double cross(const point& p1, const point& p2) {     return p1.x * p2.y - p1.y * p2.x;   }   double dist(const point& p1, const point& p2) {     double dx = p1.x - p2.x, dy = p1.y - p2.y;     return sqrt(dx * dx + dy * dy);   }   double dist(const point& p, const segment& s) {     double res = min(dist(p, s.p1), dist(p, s.p2));     double cos1 = dot(p - s.p1, s.p2 - s.p1);     double cos2 = dot(p - s.p2, s.p1 - s.p2);     if (fabs(cos1) > 1e-9 && cos1 < 0) return res;     if (fabs(cos2) > 1e-9 && cos2 < 0) return res;     double h = abs(cross(p - s.p1, s.p2 - s.p1)) / dist(s.p1, s.p2);     res = min(res, h);     return res;   }   double dist(const segment& s1, const segment& s2) {     double res = min(dist(s1.p1, s2), dist(s1.p2, s2));     res = min(res, min(dist(s2.p1, s1), dist(s2.p2, s1)));     return res;   }   void solve() {     memset(u, 0, sizeof(long long) * 1024);     for (long long i = 0; i < 1024; ++i) d[i] = 1e12;     d[0] = 0;     for (;;) {       long long v = -1;       for (long long i = 0; i < n + 2; ++i) {         if (u[i]) continue;         if (fabs(d[i] - 1e12) < 1e-9) continue;         if (v == -1 || d[v] > d[i]) v = i;       }       if (v == -1 || v == 1) break;       u[v] = 1;       if (v == 0) {         double l = dist(s, f);         if (fabs(l - a) < 1e-9 || l < a) {           d[1] = l;         }         for (long long i = 0; i < n; ++i) {           l = dist(s, t[i]);           if (fabs(l - a) > 1e-9 && l > a) continue;           if (fabs(a - d[i + 2]) > 1e-9 && a < d[i + 2]) {             d[i + 2] = a;           }         }       } else {         double l = dist(f, t[v - 2]);         if (fabs(l - a) < 1e-9 || l < a) {           double l2 = d[v] + b + l;           if (fabs(l2 - d[1]) > 1e-9 && l2 < d[1]) {             d[1] = l2;           }         }         for (long long i = 0; i < n; ++i) {           if (i + 2 == v) continue;           l = dist(t[v - 2], t[i]);           if (fabs(l - a) > 1e-9 && l > a) continue;           double l2 = d[v] + a + b;           if (fabs(l2 - d[i + 2]) > 1e-9 && l2 < d[i + 2]) {             d[i + 2] = l2;           }         }       }     }     if (fabs(d[1] - 1e12) < 1e-9)       cout << -1 << endl;     else       cout << fixed << d[1] << endl;   }   void solutionA() {     cout.precision(6);     for (; cin >> a >> b;) {       cin >> s >> f >> n;       for (long long i = 0; i < n; ++i) cin >> t[i].p1 >> t[i].p2;       solve();       cerr << endl;     }   }   