public class Euler555 {
    static java.math.BigInteger sFunc(long p, long m) {
        java.math.BigInteger total = java.math.BigInteger.ZERO;

        for (long g = 1; g <= p; g++) {
            long tMax = p / g;
            if (tMax < 2)
                continue;

            long cnt = tMax - 1;
            long sumT = tMax * (tMax + 1) / 2 - 1;

            long a1 = cnt * g * (m + g + 1);
            long a2 = cnt * g * (g - 1) / 2;

            java.math.BigInteger b = java.math.BigInteger.valueOf(g)
                    .multiply(java.math.BigInteger.valueOf(g))
                    .multiply(java.math.BigInteger.valueOf(sumT));

            total = total.add(java.math.BigInteger.valueOf(a1))
                    .add(java.math.BigInteger.valueOf(a2))
                    .subtract(b);
        }
        return total;
    }

    public static String solve() {
        return sFunc(1000000, 1000000).toString();
    }

    public static void main(String[] args) {
        System.out.println(solve());
    }
}
