At the Byteland State University marks are strings of the same length. Mark *x* is considered better than *y* if string *y* is lexicographically smaller than *x*.

Recently at the BSU was an important test work on which Vasya recived the mark *a*. It is very hard for the teacher to remember the exact mark of every student, but he knows the mark *b*, such that every student recieved mark strictly smaller than *b*.

Vasya isn't satisfied with his mark so he decided to improve it. He can swap characters in the string corresponding to his mark as many times as he like. Now he want to know only the number of different ways to improve his mark so that his teacher didn't notice something suspicious.

More formally: you are given two strings *a*, *b* of the same length and you need to figure out the number of different strings *c* such that:

1) *c* can be obtained from *a* by swapping some characters, in other words *c* is a permutation of *a*.

2) String *a* is lexicographically smaller than *c*.

3) String *c* is lexicographically smaller than *b*.

For two strings *x* and *y* of the same length it is true that *x* is lexicographically smaller than *y* if there exists such *i*, that *x*<sub class="lower-index">1</sub> = *y*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub> = *y*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*i* - 1</sub> = *y*<sub class="lower-index">*i* - 1</sub>, *x*<sub class="lower-index">*i*</sub> &lt; *y*<sub class="lower-index">*i*</sub>.

Since the answer can be very large, you need to find answer modulo 10<sup class="upper-index">9</sup> + 7.
First line contains string *a*, second line contains string *b*. Strings *a*, *b* consist of lowercase English letters. Their lengths are equal and don't exceed 10<sup class="upper-index">6</sup>.

It is guaranteed that *a* is lexicographically smaller than *b*.
In first sample from string *abc* can be obtained strings *acb*, *bac*, *bca*, *cab*, *cba*, all of them are larger than *abc*, but smaller than *ddd*. So the answer is 5.

In second sample any string obtained from *abcdef* is larger than *abcdeg*. So the answer is 0.
abc
ddd
5
abcdef
abcdeg
0
abacaba
ubuduba
64
aac
bbb
1
aaaccc
bbbbbb
9
aaaaaa
zzzzzz
0
abcde
zzzzz
119
a
c
0
aaa
ccc
0
abacabadaba
dabacabaaba
5586
ujfawuezgiy
vuqvvsivvwe
1730501
jvmzmvqexcqycjcpuqimvyovcffrdwtexpqhxswzytoaokvnexkzgycpmbgvsnyifkwvfbirtwnprmrlotlnhkogjlmxmgruklcuqstwfwoswux
vzsmohqcjpzdhfyjbljviodktdsfbmaujgtsryzlcwdvccykofgxibzrxoqrvfarjduntkenwwqwuvzzxamztghkusejmucljoedfrqpcwunkru
845854724
izybggxalv
rbqjamqnyg
183497
wdtzolgzsx
xnlokxihzw
229771
hoazcxoypk
jdmafdaqwm
116556
qdgvzritpdtoqkq
vlulirhbfjbcmdp
862600433
qszbyqbjgs
qszbyqbjgt
0
ftmhkyguxvbuqaiuxbmj
ftmhkyguxvbuqaiuxbmk
0
dkvctjuqhtotnlwkoiaegcbsigoqvfbjtbhsniksnsauinmcoffbyberonxcpsucpacnaopnjfytkbaqpsxvjppjxzcsrlqkufjt
dkvctjuqhtotnlwkoiaegcbsigoqvfbjtbhsniksnsauinmcoffbyberonxcpsucpacnaopnjfytkbaqpsxvjppjxzcsrlqkufju
0
acehlmnssx
zzzzzzzzzz
1814399
acceeffghhijjjklmmoqqqssstuuwwxyy
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
615090736
aaaabbbcccdeeffffgghhhiiiiijjjjjjjkklllmmnnnnnnooopppqqqqssttuuvvvvwwwxyyzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
56953494
aaaabbbccddddeeeeffffffggggggghhhiijjjjjjjkkkllmmmmmmmmmnnnopppppppqqqqrrrrsssttttuuuuuvvvvvvwwwwwxxxxxyyyyyyyzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
362472550
import itertools
a = str(input())
b = str(input())
arr = list(set(itertools.permutations(a, len(a))))
lengthArr = len(arr)
sortedUp = sorted(arr)[::-1]
count = 0
for i in sortedUp:
    c = "".join(i)
    if b > c > a:
        count += 1
    else:
        break
print(count)
