Little Petya was given this problem for homework:

You are given function <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/22d161d4a5bc6cfd41667ca591d56973abfe8655.png" style="max-width: 100.0%;max-height: 100.0%;"/> (here <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/e91a39ad64cd7a33e8f1b67cd60e5b40257de950.png" style="max-width: 100.0%;max-height: 100.0%;"/> represents the operation of taking the remainder). His task is to count the number of integers *x* in range [*a*;*b*] with property *f*(*x*) = *x*.

It is a pity that Petya forgot the order in which the remainders should be taken and wrote down only 4 numbers. Each of 24 possible orders of taking the remainder has equal probability of being chosen. For example, if Petya has numbers 1, 2, 3, 4 then he can take remainders in that order or first take remainder modulo 4, then modulo 2, 3, 1. There also are 22 other permutations of these numbers that represent orders in which remainder can be taken. In this problem 4 numbers wrote down by Petya will be pairwise distinct.

Now it is impossible for Petya to complete the task given by teacher but just for fun he decided to find the number of integers <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/66564024af56fb327f06ed6542f6badc5c851715.png" style="max-width: 100.0%;max-height: 100.0%;"/> with property that probability that *f*(*x*) = *x* is not less than 31.4159265352718281828459045%. In other words, Petya will pick up the number *x* if there exist at least 7 permutations of numbers *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, *p*<sub class="lower-index">3</sub>, *p*<sub class="lower-index">4</sub>, for which *f*(*x*) = *x*.
First line of the input will contain 6 integers, separated by spaces: *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, *p*<sub class="lower-index">3</sub>, *p*<sub class="lower-index">4</sub>, *a*, *b* (1 ≤ *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, *p*<sub class="lower-index">3</sub>, *p*<sub class="lower-index">4</sub> ≤ 1000, 0 ≤ *a* ≤ *b* ≤ 31415). 

It is guaranteed that numbers *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, *p*<sub class="lower-index">3</sub>, *p*<sub class="lower-index">4</sub> will be pairwise distinct.
none
2 7 1 8 2 8
0
20 30 40 50 0 100
20
31 41 59 26 17 43
9
1 2 3 4 0 0
1
1 2 3 4 1 1
0
1 2 999 1000 30 40
0
17 18 19 20 17 20
0
17 18 19 20 16 20
1
41 449 328 474 150 709
0
467 329 936 440 117 700
212
258 811 952 491 931 993
0
823 431 359 590 153 899
206
292 370 404 698 699 876
0
442 705 757 527 868 893
0
642 273 18 885 675 788
0
291 303 656 660 126 704
165
225 862 522 617 630 725
0
17 847 715 732 502 778
0
41 449 328 474 15724 19169
0
467 329 936 440 5705 28145
0
258 811 952 491 2995 11942
0
823 431 359 590 153 3902
206
292 370 404 698 19718 19895
0
442 705 757 527 1869 19912
0
642 273 18 885 23811 28703
0
291 303 656 660 7711 15141
0
225 862 522 617 1246 1341
0
17 847 715 732 778 27529
0
997 998 999 1000 0 31415
997
1 2 3 4 0 31415
1
541 931 822 948 131 193
63
956 800 909 916 89 194
106
735 794 942 991 419 490
72
818 926 827 575 153 395
243
792 858 887 679 179 356
178
937 683 742 515 366 373
8
616 747 501 875 146 264
119
760 773 638 655 111 196
86
697 855 997 589 97 192
96
998 834 706 722 277 475
199
100 101 102 103 10 20
11
from itertools import permutations


class CodeforcesTask68ASolution:
    def __init__(self):
        self.result = ''
        self.pppp_a_b = []

    def read_input(self):
        self.pppp_a_b = [int(x) for x in input().split(" ")]

    def process_task(self):
        prop = [0] * (1 + self.pppp_a_b[-1] - self.pppp_a_b[-2])
        for st in permutations(self.pppp_a_b[:4]):
            f = lambda x: (((x % st[0]) % st[1]) % st[2]) % st[3]
            for y in range(self.pppp_a_b[-2], self.pppp_a_b[-1] + 1):
                if f(y) == y:
                    prop[y - self.pppp_a_b[-2]] += 1
        has_prop = [1 if x >= 7 else 0 for x in prop]
        self.result = str(sum(has_prop))

    def get_result(self):
        return self.result


if __name__ == "__main__":
    Solution = CodeforcesTask68ASolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())
