#K70767. Counting Valid Pieces in a Grid

    ID: 33382 Type: Default 1000ms 256MiB

Counting Valid Pieces in a Grid

Counting Valid Pieces in a Grid

You are given two integer ranges: one for the height and one for the width of a piece. The first range is from \(a\) to \(b\) and the second range is from \(c\) to \(d\). Your task is to calculate the total number of distinct pieces where the height \(i\) is in the range \([a, b]\) and the width \(j\) is in the range \([c, d]\).

In other words, compute the product \((b - a + 1) \times (d - c + 1)\). The problem requires reading the input from standard input (stdin) and writing the output to standard output (stdout).

inputFormat

The input consists of a single line containing four space-separated integers \(a\), \(b\), \(c\), and \(d\), where \(a\) and \(b\) define the range for the height and \(c\) and \(d\) define the range for the width.

outputFormat

Output a single integer which is the count of valid pieces that can be formed. This output should be printed on standard output (stdout).

## sample
1 3 2 4
9