is a love guru. He has a mathematical way to determine the compatibility of two people. His method is as follows:
- Take the names of the two people and perform the following process:
- Take the value of each letter (a = 1, b = 2, c = 3, etc.) and put it to the power of its position in the name (starting from 1).
- Sum these values together and mod the number by into the range .
- Add these two values together to get the compatibility out of .
needs you to make a program that calculates two people's compatibility based on the criterion described above. The program should not be case sensitive.
Given names and , find their compatibility out of . The names are guaranteed to consist of only latin letters and letters in length.
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [70%]
A number in the range .
Explanation for Sample Output