import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    int N = readln.chomp.to!int;
    Point[][] points = new Point[][](N, 2);
    foreach(int i; 0..N) {
        int[] input = readln.split.to!(int[]);
        points[i] = [Point(input[0], input[1]), Point(input[2], input[3])];
    }
    if (N > 101^^2/2) {
        writeln(0);
        return;
    }
    double min = double.max;
    foreach(int i; 0..N) foreach(int j; i+1..N) {
        double value = getDistance(points[i], points[j]);
        if (value < min) min = value;
    }
    min.writeln;
}
double getDistance(Point[] p, Point[] q) {
    if ((p[1]-p[0]).cross(q[0]-p[0]).dot((p[1]-p[0]).cross(q[1]-p[0])) < 0 && (q[1]-q[0]).cross(p[0]-p[0]).dot((q[1]-q[0]).cross(p[1]-p[0])) < 0) {
        return 0;
    }
    if ((p[1]-p[0]).cross(q[0]-p[0]).dot((p[1]-p[0]).cross(q[1]-p[0])) < 0) {
        return min((p[0]-q[0]).cross(q[1]-q[0]).abs/dist(q[1], q[0]), (p[1]-q[1]).cross(q[1]-q[0]).abs/dist(q[1], q[0]));
    }
    if ((q[1]-q[0]).cross(p[0]-p[0]).dot((q[1]-q[0]).cross(p[1]-p[0])) < 0) {
        return min((p[0]-q[0]).cross(p[1]-p[0]).abs/dist(p[1], p[0]), (p[1]-q[1]).cross(p[1]-p[0]).abs/dist(p[1], p[0]));
    }
    return min(dist(p[0], q[0]), dist(p[0], q[1]), dist(p[1], q[0]), dist(p[1], q[1]));
}
int cross(Point p1, Point p2) {
    return p1.x*p2.y - p1.y*p2.x;
}
int dot(int z1, int z2) {
    return z1*z2;
}
int dot(Point p1, Point p2) {
    return p1.x*p2.x + p1.y*p2.y;
}
double dist(Point p1, Point p2) {
    return sqrt(((p2.x-p1.x)^^2 + (p2.y-p1.y)^^2).to!double);
}
struct Point{
    int x, y;
    this(int x, int y) {
        this.x = x;
        this.y = y;
    }
    Point opBinary(string op)(Point rhs) if (op == "+") {
        return Point(this.x+rhs.x, this.y+rhs.y);
    }
    Point opBinary(string op)(Point rhs) if (op == "-") {
        return Point(this.x-rhs.x, this.y-rhs.y);
    }
}