import java.io.*;
import java.util.*;

// Задача "Строки"
// 8-ая Интернет-олимпиада сезона 2006-2007, базовый уровень
// Автор условия: Александр Торопов, toropov@rain.ifmo.ru
// Автор решения: Максим Буздалов, buzdalov@rain.ifmo.ru

public class strings_mb {
    static void myAssert(boolean expr, String message) {
        if (!expr) throw new AssertionError(message);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader("strings.in"));
        PrintWriter out = new PrintWriter("strings.out");

        String s1 = in.readLine();
        String s2 = in.readLine();

        myAssert(s1.length() == s2.length(), "Lengths differ");
        myAssert(s1.length() <= 100000, "Strings are too long");

        long[] count1 = new long[26], count2 = new long[26];

        for (int i = 0; i < s1.length(); i++) {
            myAssert(s1.charAt(i) >= 'a' && s1.charAt(i) <= 'z', "Illegal symbol in 1st string: \"" + s1.charAt(i) + "\"");
            myAssert(s2.charAt(i) >= 'a' && s2.charAt(i) <= 'z', "Illegal symbol in 2nd string: \"" + s2.charAt(i) + "\"");
            count1[s1.charAt(i) - 'a']++;
            count2[s2.charAt(i) - 'a']++;
        }

        long answer = 0;
        for (int i = 0; i < 26; i++) {
            for (int j = 0; j < 26; j++) {
                answer += count1[i] * count2[j] * Math.min(Math.abs(i - j), 26 - Math.abs(i - j));
            }
        }

        out.println(answer * s1.length());
        out.close();
        in.close();
    }
}