The organizers of the Lemon Cup are planning to prepare prizes for the contest. There are types of prizes in total, and each type is numbered from to . Initially, the quantity of every prize is .
Jaewon wants to use these prizes to create gift bundles. A single gift bundle must contain two or more consecutively numbered prizes, and exactly one prize of each included type is used.
The following two types of queries are given.
1 l r k: Purchase items for each of the prizes numbered . However, if , it means items of each corresponding prize have been discarded.2 l r: Print the minimum number of gift bundles that can be made by using all the prizes numbered . At this time, only the prizes numbered must be used. If it is impossible to make gift bundles using all the prizes, print -1.
Every time a type 2 query is given, print the answer of the query.
Input
The input is given in the following format.
Each () is in one of the following two formats.
Output
Every time a type 2 query is given, print the answer of the query, separated by new line.
Constraints
- .
- .
- ().
- ().
- At any point, the quantity of the -th prize will neither become less than nor exceed ().
Subtasks
Samples
입력
5 7
1 1 4 3
1 2 3 1
2 1 4
1 2 2 7
2 1 4
1 2 2 -5
2 1 3
출력
4
-1
6