P16074 [ICPC 2023 NAC] Four Square

Description

Inspired by a Piet Mondrian painting, you want to make a four-pane window out of four colored rectangles of glass. You are given the sizes of the four panes of glass. Can you arrange them into a square? You may rotate the panes. The panes should cover the entire square without overlap.

Input Format

The input consists of exactly four lines. Each of the four lines contains two integers $w$ and $h$ ($1 \leq w, h \leq 1,000$), representing the width and height of one of the four rectangular panes of glass.

Output Format

Output a single integer, which is $1$ if the four panes can be arranged to form a square, and $0$ otherwise.