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

namespace dwacon6th_prelims_b
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var x = CIn.ReadIntArray(N);

      var mod = new Mod((int)1e9 + 7);
      mod.InitSeq(N);

      var fac = mod.Fac(N - 1);
      var section = 0L;
      var ans = 0L;

      for (var i = 1; i < N; i++)
      {
        section = mod.Add(section, mod.Div(fac, i));
        ans = mod.Add(ans, mod.Mul(section, x[i] - x[i - 1]));
      }

      Console.WriteLine(ans);
    }
  }

  class Mod
  {
    public int N { get; }
    private readonly List<long> fac = new List<long>() { 1, 1 };
    private readonly List<long> inv = new List<long>() { 0, 1 };
    private readonly List<long> facInv = new List<long>() { 1, 1 };

    public Mod(int n)
    {
      N = n;
    }

    public long Add(long a, long b) => (a % N + b % N + N) % N;
    public long Sub(long a, long b) => Add(a, -b);
    public long Mul(long a, long b) => (a % N * b % N + N) % N;
    public long Div(long a, long b) => Mul(a, Inv(b));

    public long Inv(long a)
    {
      if (a < inv.Count) return inv[(int)a];
      long b = N, x = 1, y = 0, tmp;
      while (b != 0)
      {
        var q = a / b;
        tmp = y;
        y = x - q * y;
        x = tmp;
        tmp = b;
        b = a - q * b;
        a = tmp;
      }
      return (x % N + N) % N;
    }

    public long Pow(long a, long n)
    {
      var result = 1L;
      while (n > 0)
      {
        if ((n & 1) == 1) result = Mul(result, a);
        a = Mul(a, a);
        n >>= 1;
      }
      return result;
    }

    public void InitSeq(int n)
    {
      for (var i = fac.Count; i <= n; i++)
      {
        fac.Add(fac[i - 1] * i % N);
        inv.Add(N - inv[N % i] * (N / i) % N);
        facInv.Add(facInv[i - 1] * inv[i] % N);
      }
    }

    public long Fac(int n)
    {
      InitSeq(n);
      return fac[n];
    }

    public long Per(int n, int k)
    {
      if (n < k || n < 0 || k < 0) return 0;
      InitSeq(n);
      return fac[n] * facInv[n - k] % N;
    }

    public long Com(int n, int k)
    {
      if (n < k || n < 0 || k < 0) return 0;
      InitSeq(n);
      return fac[n] * (facInv[k] * facInv[n - k] % N) % N;
    }
  }
  class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }
  }
}


Measured memory_bytes: 25952