using System;
class ProgramB
    {
        static void Main(string[] args)
        {
            
            //入力
            long n  = long.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            ulong[] x = new ulong[n];
            ulong BIG = 1000000007;

            for(int i = 0;i < n;i++)
                x[i] = ulong.Parse(input[i]);
            
            ulong kumiawase = 1;

            for(int i = 2;i < n;i++)
            {
                kumiawase *= (ulong)i;
                kumiawase %= BIG;
            }

            ulong kumi = kumiawase;
            
            ulong sum = 0;
            
            
            for(int i = 1;i < n;i++)
            {
                ulong temp = x[i] - x[i -1];
                if(i != 1)
                    kumi += kumiawase/(ulong)i;
                sum += ((temp % BIG) * (kumi % BIG)) % BIG;
                sum %= BIG;
            }

            Console.WriteLine(sum);
                
        }
    }
           