K. Number with Bachelors
time limit per test
2 s
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
6
d 0 10 20
h 0 10 1f
d 1 10
h 1 f
d 1 1000000000
h 1 ffffffffffffffff
Output
10
f
9
e
-
-