#C8277. Smallest Enclosing Rectangle

    ID: 52241 Type: Default 1000ms 256MiB

Smallest Enclosing Rectangle

Smallest Enclosing Rectangle

Given a list of rectangular plant plots, each defined by the coordinates of its top-left corner and its dimensions (width and height), your task is to determine the dimensions of the smallest rectangle that can fully enclose all of these plots.

Specifically, for each plant represented as a tuple \((x, y, w, h)\), the rectangle extends from \(x\) to \(x+w\) along the horizontal axis and from \(y\) to \(y+h)\) along the vertical axis. The solution should compute the minimum \(x\) and \(y\) values, as well as the maximum \(x+w\) and \(y+h\) values over all plants, and then output the width and height of the enclosing rectangle as \(\text{width} = max_x - min_x\) and \(\text{height} = max_y - min_y\).

Note: All formulae are expressed in \(\LaTeX\) format. For example, the width of the enclosing rectangle is \(\text{width} = max_x - min_x\) and the height is \(\text{height} = max_y - min_y\).

inputFormat

The first line of input contains an integer \(n\) representing the number of plants. The following \(n\) lines each contain four space-separated integers: \(x\), \(y\), \(w\), and \(h\). Here, \(x\) and \(y\) denote the coordinates of the top-left corner of a plant, while \(w\) and \(h\) denote its width and height respectively.

outputFormat

Output two integers separated by a space: the width and the height of the smallest rectangle that encloses all the plant regions.

## sample
1
1 2 3 4
3 4

</p>