f(X) = A + X + B + X + C

Count occurrences of pattern F in the K-fold string expansion f(X)=A+X+B+X+C applied to S, modulo 1e9+7.

Hard8String matchingDynamic programmingMatrixStringNo attempts yetTime limit2sMemory limit512 MB

Problem

A function ff takes a string XX and returns f(X)=A+X+B+X+Cf(X) = A + X + B + X + C, where ++ is string concatenation and AA, BB, CC are fixed non-empty strings.

Repeated application is defined by f1(X)=f(X)f^1(X) = f(X) and fK(X)=f(fK1(X))f^K(X) = f(f^{K-1}(X)).

You are given strings AA, BB, CC, SS, FF and an integer KK. Count how many times FF occurs as a substring of fK(S)f^K(S). Occurrences that start at different positions are counted separately, even when they overlap.

Input

The first line contains AA, BB, CC, SS, FF and KK, separated by spaces. AA, BB, CC, SS and FF are strings of lowercase letters whose length is between 1 and 50. KK is a natural number not greater than 10,000,000.

Output

Print the number of occurrences of FF as a substring of fK(S)f^K(S), modulo 1,000,000,007.