def area_or_perimeter(l, w):
    """
    Find either the perimeter of a rectangle or the area of a square.
    :param l: an integer value.
    :param w: an integer value.
    :return: If it is a square, return its area. If it is a rectangle, return its perimeter
    """
    return l * w if l == w else (l + w) * 2