def METHOD_NAME(p, polygon):
    """ Determine if the given point is inside the polygon
    p (int, int): x, y of the point
    polygon (4 x (int, int)): the x,y coordinates of each vertices of the polygon
    return (bool): True if the point is within the polygon
    """
    x, y = p
    n = len(polygon)
    inside = False
    p1x, p1y = polygon[0]
    for i in range(n+1):
        p2x, p2y = polygon[i % n]
        # consider the case where the point is on the vertex of the polygon
        if p2x == x and p2y == y:
            return True
        if y > min(p1y, p2y):
            if y <= max(p1y, p2y):
                if x <= max(p1x, p2x):
                    if p1y != p2y:
                        xinters = (y - p1y) * (p2x - p1x)/(p2y - p1y) + p1x
                    if p1x == p2x or x <= xinters:
                        inside = not inside
        p1x, p1y = p2x, p2y
    return inside