Problem #307
Eloquent
Alice is very confident about her Vocabulary, according to her lively words are those which contain only characters A,B,C and the frequency of each of them should be the same. Alice has a word \textit{S} of 1999998 characters (A,B,C each occur 666666 times). Now Bob has a word \textit{T} (which is lively as well) and he wants to know the minimum number of moves he needs to make in order to change the word from S to T in the worst case (irrespective of the words S and T). In a single move Bob can only swap neighboring letters. Report the answer divided 2 modulo 1000000007.