Number of Representable High#4571

Number of Representable High

1 second
256 megabytes
Hard

Given two integers and . A number is called representable if it can be written as the sum

x = x_1 + x_2 + \dots + x_n

for some finite (possibly zero) number of terms x_i, where each x_i is equal to either or .

Determine how many distinct numbers in the interval are representable.

Constraints

Input

The input consists of a single line containing the integers , , , and .

Output

Output the number of distinct numbers in the interval that are representable as sums of and .

Examples

Example 1

Loading
Loading