import math


def calculate_dist(coord, a, b, c):
    """Calculate the distance d from a point (x0, y0) to the line ax + by + c = 0,
    defined as the shortest distance between a fixed point and any point on the
    line. It is the length of the line segment that is perpendicular to the
    line and passes through the point.

    Args:
        coord (Tuple[float, float]): the latitude and longitude to match
        a (float): a in ax + by + c = 0
        b (float): b in ax + by + c = 0
        c (float): c in ax + by + c = 0
    Returns:
        d (float): distance
    """
    x0 = coord[0]
    y0 = coord[1]
    try:
        return abs(a*x0 + b*y0 + c)/math.sqrt(a*a + b*b)
    except ZeroDivisionError:
        return math.inf