using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B {
    class Program {
        static long mod = 1000000007;

        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());

            var x = Console.ReadLine().Split(' ').Select(p => int.Parse(p)).ToArray();

            long ans = 0;

            long startIndex = 1;

            for (int i = 0; i < N - 1; i++) {
                long dist = x[i + 1] - x[i];

                //Console.WriteLine(dist);
                if (i >= 1) {
                    startIndex = startIndex * (i + 1) % mod + FactorialMod(i);
                }
                

                //Console.WriteLine(startIndex);

                long startValue = dist * startIndex;

                ans += startValue * FactorialModBetween(N - 1, (i + 1)) % mod;

                //Console.WriteLine(startIndex * FactorialModBetween(N - 1, (i + 1)));





            }

            Console.WriteLine(ans % mod);
        }

        //階乗を求める
        static long Factorial(long N) {
            if (N == 1) {
                return 1;
            }
            if (N == 0) {
                return 1;
            }
            return N * Factorial(N - 1);
        }

        //階乗を求める(mod)
        static long FactorialMod(long N) {
            if (N == 1) {
                return 1;
            }
            return N * FactorialMod(N - 1) % mod;
        }

        //二つの間の階乗を求める
        static long FactorialBetween(long A, long B) {
            long value = 1;
            long index = 0;
            while ((A - index) != B) {
                value *= (A - index);
                index++;

            }

            return value;
        }

        //二つの間の階乗を求める(mod)
        static long FactorialModBetween(long A, long B) {
            long value = 1;
            long index = 0;
            while ((A - index) != B) {
                value *= (A - index);
                value %= mod;
                index++;

            }

            return value;
        }
    }
}
