using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class ProgramB
    {
        static void Main(string[] args)
        {
            
            //入力
            int n  = int.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 sum = 0;

            ulong kumiawase= 1;

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