import java.io.*;
import java.util.*;

public class B {

	static final int P = 1_000_000_007;

	void submit() {
		int n = nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}

		int sign = 1;
		while (n % 4 != 1) {
			int[] b = new int[n - 1];
			for (int i = 0; i < n - 1; i++) {
				b[i] = a[i] + sign * a[i + 1];
				if (b[i] >= P) {
					b[i] -= P;
				} else if (b[i] < 0) {
					b[i] += P;
				}
				sign *= -1;
			}
			n--;
			a = b;
		}

		int cn = n / 2;
		int coef = 1;

		int ret = 0;

		for (int i = 0; i <= cn; i++) {
			ret += (int)((long)a[2 * i] * coef % P);
			if (ret >= P) {
				ret -= P;
			}
			if (i != cn) {
				coef = (int)((long)coef * (cn - i) % P * inv(i + 1) % P);
			}
		}

		out.println(ret);
	}

	int inv(int x) {
		return x == 1 ? 1 : (P - (int) ((long) (P / x) * inv(P % x) % P));
	}

	void preCalc() {

	}

	void stress() {

	}

	void go(int n) {
		int[][] a = new int[n][n];
		for (int i = 0; i < n; i++) {
			a[i][i] = 1;
		}

		int sign = -1;
		for (int sz = n; sz > 1; sz--) {
			int[][] b = new int[sz - 1][n];
			for (int i = 0; i < sz - 1; i++) {
				for (int j = 0; j < n; j++) {
					b[i][j] = a[i][j] + sign * a[i + 1][j];
				}
				sign *= -1;
			}
			a = b;
//			System.err.println(Arrays.deepToString(a));
		}
		System.err.println(n + ": " + Arrays.toString(a[0]));
	}

	void test() {
		go(5);
//		for (int n = 1; n <= 30; n += 4) {
//			go(n);
//		}
	}

	B() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
//		preCalc();
		submit();
		//stress();
//		test();
		out.close();
	}

	static final Random rng = new Random();

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new B();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}


/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class D815 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int mod = (int) 1e9 + 7;
	long factorial[];

	void solve() {
		int n = ni();
		if(n==1){
			out.println(ni());
			return;
		}
		factorial = new long[200001];
		ArrayList<Integer> a = new ArrayList<>();
		for (int i = 0; i < n; i++)
			a.add(ni());
		if (n % 2 == 1) {
			int f = 1;
			while (f != 1 || a.size() % 2 != 0) {
				ArrayList<Integer> temp = new ArrayList<>();
				for (int i = 0; i < a.size() - 1; i++) {
					temp.add(a.get(i) + (f * a.get(i + 1)));
					f = -f;
				}
				a = temp;
			}
		}
		n = a.size();
		long s1 = 0;
		long s2 = 0;
		int k = a.size() / 2;
		for (int i = 0; i < a.size() - 1; i += 2) {
			long f = nCk(k-1, i / 2);
			s1 += (f * a.get(i)) % mod;
			s1 %= mod;
			s2 += (f * a.get(i + 1)) % mod;
			s2 %= mod;
		}
		long ans = 0;
		if(n%4==0){
			ans = (s1+mod+-s2)%mod;
		}else
			ans = (s1+s2)%mod;
		out.println(ans);
	}

	long nCk(long n, long k) {
		// nCk = (n!)/((n-k)!*k!)
		if (n < k) {
			return 0;
		}
		if (k == n || k == 0) {
			return 1;
		}
		long numerator = factorial[(int) n];
		long denominator = (factorial[(int) (n - k)] * factorial[(int) k]) % mod;
		denominator = pow(denominator, mod - 2, mod);
		return (numerator * denominator) % mod;
	}

	long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	void findfactorial() {
		factorial[0] = 1;
		for (int i = 1; i < 200001; i++) {
			factorial[i] = (i * factorial[i - 1]) % mod;
		}
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new D815().run();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b !=
									// ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class D815 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int mod = (int) 1e9 + 7;
	long factorial[];

	void solve() {
		int n = ni();
		if(n==1){
			out.println(ni());
			return;
		}
		factorial = new long[200001];
		findfactorial();
		ArrayList<Long> a = new ArrayList<>();
		for (int i = 0; i < n; i++)
			a.add(nl());
		if (n % 2 == 1) {
			int f = 1;
			while (f != 1 || a.size() % 2 != 0) {
				ArrayList<Long> temp = new ArrayList<>();
				for (int i = 0; i < a.size() - 1; i++) {
					temp.add(a.get(i) + (f * a.get(i + 1)));
					f = -f;
				}
				a = temp;
			}
		}
		n = a.size();
		long s1 = 0;
		long s2 = 0;
		int k = a.size() / 2;
		for (int i = 0; i < a.size() - 1; i += 2) {
			long f = nCk(k-1, i / 2);
			s1 += (f * a.get(i)) % mod;
			s1 %= mod;
			s2 += (f * a.get(i + 1)) % mod;
			s2 %= mod;
		}
		long ans = 0;
		if(n%4==0){
			ans = (s1+mod+-s2)%mod;
		}else
			ans = (s1+s2)%mod;
		out.println(ans);
	}

	long nCk(long n, long k) {
		// nCk = (n!)/((n-k)!*k!)
		if (n < k) {
			return 0;
		}
		if (k == n || k == 0) {
			return 1;
		}
		long numerator = factorial[(int) n];
		long denominator = (factorial[(int) (n - k)] * factorial[(int) k]) % mod;
		denominator = pow(denominator, mod - 2, mod);
		return (numerator * denominator) % mod;
	}

	long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	void findfactorial() {
		factorial[0] = 1;
		for (int i = 1; i < 200001; i++) {
			factorial[i] = (i * factorial[i - 1]) % mod;
		}
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new D815().run();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b !=
									// ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class D815 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int mod = (int) 1e9 + 7;
	long factorial[];

	void solve() {
		int n = ni();
		factorial = new long[200001];
		ArrayList<Integer> a = new ArrayList<>();
		for (int i = 0; i < n; i++)
			a.add(ni());
		if (n % 2 == 1) {
			int f = 1;
			while (f != 1 || a.size() % 2 != 0) {
				ArrayList<Integer> temp = new ArrayList<>();
				for (int i = 0; i < a.size() - 1; i++) {
					temp.add(a.get(i) + (f * a.get(i + 1)));
					f = -f;
				}
				a = temp;
			}
		}
		n = a.size();
		long s1 = 0;
		long s2 = 0;
		int k = a.size() / 2;
		for (int i = 0; i < a.size() - 1; i += 2) {
			long f = nCk(k-1, i / 2);
			s1 += (f * a.get(i)) % mod;
			s1 %= mod;
			s2 += (f * a.get(i + 1)) % mod;
			s2 %= mod;
		}
		long ans = 0;
		if(n%4==0){
			ans = (s1+mod+-s2)%mod;
		}else
			ans = (s1+s2)%mod;
		out.println(ans);
	}

	long nCk(long n, long k) {
		// nCk = (n!)/((n-k)!*k!)
		if (n < k) {
			return 0;
		}
		if (k == n || k == 0) {
			return 1;
		}
		long numerator = factorial[(int) n];
		long denominator = (factorial[(int) (n - k)] * factorial[(int) k]) % mod;
		denominator = pow(denominator, mod - 2, mod);
		return (numerator * denominator) % mod;
	}

	long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	void findfactorial() {
		factorial[0] = 1;
		for (int i = 1; i < 200001; i++) {
			factorial[i] = (i * factorial[i - 1]) % mod;
		}
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new D815().run();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b !=
									// ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class D815 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int mod = (int) 1e9 + 7;
	long factorial[];

	void solve() {
		int n = ni();
		if(n==1){
			out.println(ni());
			return;
		}
		factorial = new long[200001];
		findfactorial();
		ArrayList<Long> a = new ArrayList<>();
		for (int i = 0; i < n; i++)
			a.add(nl());
		if (n % 2 == 1) {
			int f = 1;
			while (f != 1 || a.size() % 2 != 0) {
				ArrayList<Long> temp = new ArrayList<>();
				for (int i = 0; i < a.size() - 1; i++) {
					temp.add((a.get(i) + ((mod+ f * a.get(i + 1))%mod))%mod);
					f = -f;
				}
				a = temp;
			}
		}
		n = a.size();
		long s1 = 0;
		long s2 = 0;
		int k = a.size() / 2;
		for (int i = 0; i < a.size() - 1; i += 2) {
			long f = nCk(k-1, i / 2);
			s1 += (f * a.get(i)) % mod;
			s1 %= mod;
			s2 += (f * a.get(i + 1)) % mod;
			s2 %= mod;
		}
		long ans = 0;
		if(n%4==0){
			ans = (s1+mod-s2)%mod;
		}else
			ans = (s1+s2)%mod;
		out.println(ans);
	}

	long nCk(long n, long k) {
		// nCk = (n!)/((n-k)!*k!)
		if (n < k) {
			return 0;
		}
		if (k == n || k == 0) {
			return 1;
		}
		long numerator = factorial[(int) n];
		long denominator = (factorial[(int) (n - k)] * factorial[(int) k]) % mod;
		denominator = pow(denominator, mod - 2, mod);
		return (numerator * denominator) % mod;
	}

	long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	void findfactorial() {
		factorial[0] = 1;
		for (int i = 1; i < 200001; i++) {
			factorial[i] = (i * factorial[i - 1]) % mod;
		}
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new D815().run();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b !=
									// ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.util.Map.Entry;

import static java.lang.Math.*;

public class B extends PrintWriter {

    long mod = 1_000_000_000 + 7;

    long inv(long num) {
        long inv = 1;
        for (long p = mod - 2; p > 0; p /= 2) {
            if (p % 2 == 1) {
                inv = (inv * num) % mod;
            }
            num = (num * num) % mod;
        }
        return inv;
    }

    void run() {
        int n = nextInt();

        long[] a = new long[n];

        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }

        long[] x = gen(n);

        long sum = 0;

        for (int i = 0; i < n; i++) {
            sum = (sum + (a[i] * x[i]) % mod) % mod;
        }

        println(sum);

    }

    long[] test(int n) {

        long[][] v = new long[n][n];

        long s = 1;

        for (int j = 0; j < n; j++) {
            v[j][j] = 1;
        }

        for (int m = n - 1; m >= 1; m--) {
            long[][] u = new long[m][n];

            for (int i = 0; i < m; i++) {

                for (int j = 0; j < n; j++) {
                    u[i][j] = v[i][j] + s * v[i + 1][j];
                }
                s *= -1;
            }
            v = u;
        }

        long[] x = v[0];

        for (int j = 0; j < n; j++) {
            x[j] = (mod + x[j]) % mod;
        }

        return x;
    }

    long[] gen(int n) {
        switch (n % 4) {
        case 0:
            return gen0(n);
        case 1:
            return gen1(n);
        case 2:
            return gen2(n);
        default:
            return gen3(n);
        }
    }

    long[] gen0(int n) {

        long[] f = new long[3 * n + 22];

        f[0] = 1;

        for (int i = 1; i < f.length; i++) {
            f[i] = (f[i - 1] * i) % mod;
        }

        int m = n / 2;

        long[] x = new long[n];

        for (int i = 0, p = 0; i < m; i++) {
            long val = (f[m - 1] * inv((f[i] * f[m - i - 1]) % mod)) % mod;
            x[p++] = val;
            x[p++] = (mod - val) % mod;
        }

        return x;
    }

    long[] gen1(int n) {

        long[] f = new long[3 * n + 22];

        f[0] = 1;

        for (int i = 1; i < f.length; i++) {
            f[i] = (f[i - 1] * i) % mod;
        }

        int m = (n / 2) + 1;

        long[] x = new long[n];

        for (int p = 0; p < n; p++) {
            if (p % 2 == 0) {
                int i = p / 2;
                x[p] = (f[m - 1] * inv((f[i] * f[m - i - 1]) % mod)) % mod;
            }
        }

        return x;
    }

    long[] gen2(int n) {
        long[] f = new long[3 * n + 22];

        f[0] = 1;

        for (int i = 1; i < f.length; i++) {
            f[i] = (f[i - 1] * i) % mod;
        }

        int m = n / 2;

        long[] x = new long[n];

        for (int i = 0, p = 0; i < m; i++) {
            long val = (f[m - 1] * inv((f[i] * f[m - i - 1]) % mod)) % mod;
            x[p++] = val;
            x[p++] = val;
        }

        return x;
    }

    long[] gen3(int n) {

        long[] x = new long[n];

        long[] y = gen2(n - 1);

        int p = 0;

        x[p++] = 1;

        for (int i = 2; i < n; i++) {
            if (i % 2 == 1) {
                x[p++] = (y[i - 1] - y[i - 2] + mod) % mod;
            } else {
                x[p++] = (y[i - 1] + y[i - 2] + mod) % mod;
            }
        }

        x[p++] = mod - 1;

        return x;
    }

    void skip() {
        while (hasNext()) {
            next();
        }
    }

    int[][] nextMatrix(int n, int m) {
        int[][] matrix = new int[n][m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                matrix[i][j] = nextInt();
        return matrix;
    }

    String next() {
        while (!tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(nextLine());
        return tokenizer.nextToken();
    }

    boolean hasNext() {
        while (!tokenizer.hasMoreTokens()) {
            String line = nextLine();
            if (line == null) {
                return false;
            }
            tokenizer = new StringTokenizer(line);
        }
        return true;
    }

    int[] nextArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = nextInt();
        }
        return array;
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException err) {
            return null;
        }
    }

    public B(OutputStream outputStream) {
        super(outputStream);
    }

    static BufferedReader reader;
    static StringTokenizer tokenizer = new StringTokenizer("");
    static Random rnd = new Random();
    static boolean OJ;

    public static void main(String[] args) throws IOException {
        OJ = System.getProperty("ONLINE_JUDGE") != null;
        B solution = new B(System.out);
        if (OJ) {
            reader = new BufferedReader(new InputStreamReader(System.in));
            solution.run();
        } else {
            reader = new BufferedReader(new FileReader(new File(B.class.getName() + ".txt")));
            long timeout = System.currentTimeMillis();
            while (solution.hasNext()) {
                solution.run();
                solution.println();
                solution.println("----------------------------------");
            }
            solution.println("time: " + (System.currentTimeMillis() - timeout));
        }
        solution.close();
        reader.close();
    }
}


#include <bits/stdc++.h>

using namespace std;

#define MOD ((int)1e9+7)
#define MAXN 200010

long long a[MAXN], fat[MAXN], inv_fat[MAXN];

long long binom(int a, int b){
    return (fat[a] * ((inv_fat[a-b] * inv_fat[b])%MOD))%MOD;
}

long long mod_pow(long long b, int x){
    if(x == 0) return 1;
    if(x & 1) return (b * mod_pow(b, x-1))%MOD;
    long long tmp = mod_pow(b, x/2);
    return (tmp * tmp)%MOD;
}

int main(){
    fat[0] = inv_fat[0] = 1;
    for(int i=1; i<MAXN; i++){
        fat[i] = (i * fat[i-1])%MOD;
        inv_fat[i] = mod_pow(fat[i], MOD-2);
    }

    int n;
    while(scanf("%d", &n) > 0){
        for(int i=1; i<=n; i++){
            scanf("%lld", &a[i]);
        }

        int sign = 1;

        while(n > 1 and !(n%2 == 0 and sign == 1)){
            for(int i=1; i<n; i++){
                a[i] = (a[i] + sign*a[i+1] + MOD)%MOD;
                //a[i] = (a[i] + sign*a[i+1]);
                sign *= -1;
            }
            n--;
        }

        if(n == 1){
            printf("%lld\n", a[1]);
            continue;
        }

        long long ans = 0;
        sign = (n-2)%4 == 0 or (n-2)%4 == 3 ? 1 : -1;

        for(int i=1, j=0; i<=n; i+=2, j++){
            //printf("i = %d, cont = %lld\n", i, binom(n/2-1, j));
            ans = (ans + ((binom(n/2-1, j)*((a[i] + sign*a[i+1] + MOD)%MOD))%MOD))%MOD;
        }

        printf("%lld\n", ans);
 //       break;
    }
}


#include <bits/stdc++.h>

using namespace std;

#define MOD ((int)1e9+7)
#define MAXN 200010

long long a[MAXN], fat[MAXN], inv_fat[MAXN];

long long binom(int a, int b){
    return (fat[a] * ((inv_fat[a-b] * inv_fat[b])%MOD))%MOD;
}

long long mod_pow(long long b, int x){
    if(x == 0) return 1;
    if(x & 1) return (b * mod_pow(b, x-1))%MOD;
    long long tmp = mod_pow(b, x/2);
    return (tmp * tmp)%MOD;
}

int main(){
    fat[0] = inv_fat[0] = 1;
    for(int i=1; i<MAXN; i++){
        fat[i] = (i * fat[i-1])%MOD;
        inv_fat[i] = mod_pow(fat[i], MOD-2);
    }

    int n;
    while(scanf("%d", &n) > 0){
        for(int i=1; i<=n; i++){
            scanf("%lld", &a[i]);
        }

        int sign = 1;

        while(n > 1 and !(n%2 == 0 and sign == 1)){
            for(int i=1; i<n; i++){
                a[i] = (a[i] + sign*a[i+1] + MOD)%MOD;
                //a[i] = (a[i] + sign*a[i+1]);
                sign *= -1;
            }
            n--;
        }

        if(n == 1){
            printf("%lld\n", a[1]);
            continue;
        }

        long long ans = 0;

        for(int i=1, j=0; i<=n; i+=2, j++){
            //printf("i = %d, cont = %lld\n", i, binom(n/2-1, j));
            ans = (ans + ((binom(n/2-1, j)*((a[i] - a[i+1] + MOD)%MOD))%MOD))%MOD;
        }

        printf("%lld\n", ans);
 //       break;
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb push_back

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int maxn = 200000 + 10;
const int oo = 0x7fffffff;

template<typename T> T read() {
	T n(0), f(1);
	char ch = getchar();
	for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48;
    return n * f;
}

const int mod = 1e9 + 7;

LL fac[maxn], ifac[maxn];
LL fpm(LL base, LL exp) {
    LL ans = 1;
    for(; exp > 0; exp >>= 1) {
        if(exp & 1)
            ans = ans * base % mod;
        base = base * base % mod;
    }
    return ans;
}

int n;
LL a[maxn];
int main() {
#ifndef ONLINE_JUDGE
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%I64d", a + i);
        a[i] %= mod;
    }

    LL f = 1;
    while(1) {
        if(n % 2 == 0 && f == 1) break;

        if(n == 1) { return printf("%I64d\n", a[0]), 0; }
        else {
            for(int i = 0; i < n; i++) {
                (a[i] += f*a[i+1] + mod) %= mod;
                f = -f;
            } --n;
        }
    }

    LL C_i = 1, ans = 0;
    for(int i = 0; i < n/2; i++) {
        ans = (ans + C_i * a[i << 1]) % mod;

        if(n % 4 == 0)
            ans = (ans - C_i * a[i << 1 | 1]) % mod;
        else
            ans = (ans + C_i * a[i << 1 | 1]) % mod;

        C_i = C_i * fpm(i+1, mod-2) % mod * (n/2-1-i) % mod;
    }

    printf("%I64d\n", (ans + mod) % mod);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb push_back

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int maxn = 200000 + 10;
const int oo = 0x7fffffff;

template<typename T> T read() {
	T n(0), f(1);
	char ch = getchar();
	for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48;
    return n * f;
}

const int mod = 1e9 + 7;

LL fac[maxn], ifac[maxn];
LL fpm(LL base, LL exp) {
    LL ans = 1;
    for(; exp > 0; exp >>= 1) {
        if(exp & 1)
            ans = ans * base % mod;
        base = base * base % mod;
    }
    return ans;
}

int n;
LL a[maxn];
int main() {
#ifndef ONLINE_JUDGE
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%I64d", a + i);

    LL f = 1;
    while(1) {
        if(n % 2 == 0 && f == 1) break;

        if(n == 1) { return printf("%I64d\n", a[0]), 0; }
        else {
            for(int i = 0; i < n; i++) {
                (a[i] += f*a[i+1] + mod) %= mod;
                f = -f;
            } --n;
        }
    }

    LL C_i = 1, ans = 0;
    for(int i = 0; i < n/2; i++) {
        ans = (ans + C_i * a[i << 1]) % mod;

        if(n % 4 == 0)
            ans = (ans - C_i * a[i << 1 | 1]) % mod;
        else
            ans = (ans + C_i * a[i << 1 | 1]) % mod;

        C_i = C_i * fpm(i+1, mod-2) % mod * (n/2-1-i) % mod;
    }

    printf("%I64d\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb push_back

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int maxn = 200000 + 10;
const int oo = 0x7fffffff;

template<typename T> T read() {
	T n(0), f(1);
	char ch = getchar();
	for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48;
    return n * f;
}

const int mod = 1e9 + 7;

LL fac[maxn], ifac[maxn];
LL fpm(LL base, LL exp) {
    LL ans = 1;
    for(; exp > 0; exp >>= 1) {
        if(exp & 1)
            ans = ans * base % mod;
        base = base * base % mod;
    }
    return ans;
}

int n;
LL a[maxn];
int main() {
#ifndef ONLINE_JUDGE
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] %= mod;
    }

    LL f = 1;
    while(1) {
        if(n % 2 == 0 && f == 1) break;

        if(n == 1) { return cout << a[0], 0; }
        else {
            for(int i = 0; i < n-1; i++) {
                (a[i] += f*a[i+1] + mod) %= mod;
                f = -f;
            } --n;
        }
    }

    LL C_i = 1, ans = 0;
    for(int i = 0; i < n/2; i++) {
        ans = (ans + C_i * a[i << 1]) % mod;

        if(n % 4 == 0)
            ans = (ans - C_i * a[i << 1 | 1]) % mod;
        else
            ans = (ans + C_i * a[i << 1 | 1]) % mod;

        C_i = C_i * fpm(i+1, mod-2) % mod * (n/2-1-i) % mod;
    }

    cout << (ans + mod) % mod;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb push_back

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int maxn = 200000 + 10;
const int oo = 0x7fffffff;

template<typename T> T read() {
	T n(0), f(1);
	char ch = getchar();
	for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48;
    return n * f;
}

const int mod = 1e9 + 7;

LL fac[maxn], ifac[maxn];
LL fpm(LL base, LL exp) {
    LL ans = 1;
    for(; exp > 0; exp >>= 1) {
        if(exp & 1)
            ans = ans * base % mod;
        base = base * base % mod;
    }
    return ans;
}

int n;
LL a[maxn];
int main() {
#ifndef ONLINE_JUDGE
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%I64d", a + i);

    LL f = 1;
    while(1) {
        if(n % 2 == 0 && f == 1) break;

        if(n == 1) { return printf("%I64d\n", a[0]), 0; }
        else {
            for(int i = 0; i < n; i++) {
                (a[i] += f*a[i+1] + mod) %= mod;
                f = -f;
            } --n;
        }
    }

    LL C_i = 1, ans = 0;
    for(int i = 0; i < n/2; i++) {
        ans = (ans + C_i * a[i << 1]) % mod;

        if(n % 4 == 0)
            ans = (ans - C_i * a[i << 1 | 1]) % mod;
        else
            ans = (ans + C_i * a[i << 1 | 1]) % mod;

        C_i = C_i * fpm(i+1, mod-2) % mod * (n/2-1-i) % mod;
    }

    printf("%I64d\n", (ans + mod) % mod);
    return 0;
}


#include<cstdio>
using namespace std;
long long P=1e9+7,a[200010],ans,ans1,ans2,f[200010],inv[200010];
long long sqr(long long x){return x*x%P;}
long long poww(long long a,long long n)
{
	if (n==0) return 1;
	if (n%2==0) return sqr(poww(a,n/2));
	return sqr(poww(a,n/2))*a%P;
}
int n,m,i;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%I64d",&a[i]);
	if (n%2==1)
	{
		m=n/2;
		f[0]=inv[0]=1;
		for (i=1;i<=m;i++)
		{
			f[i]=f[i-1]*(long long)i%P;
			inv[i]=inv[i-1]*poww(i,P-2)%P;
	    }
	    ans=0;
	    for (i=0;i<=m;i++)
	    {
	    	long long now=f[m]*inv[i]%P*inv[m-i]%P;
	    	now=now*a[2*i+1]%P;
	    	if (now<0) now+=P;
	    	ans=(ans+now)%P;
		}
		printf("%I64d\n",ans);
	}
	else
	{
		m=n/2-1;
		f[0]=inv[0]=1;
		for (i=1;i<=m;i++)
		{
			f[i]=f[i-1]*(long long)i%P;
			inv[i]=inv[i-1]*poww(i,P-2)%P;
	    }
	    ans1=0;ans2=0;
	    for (i=0;i<=m;i++)
	    {
	    	long long now=f[m]*inv[i]%P*inv[m-i]%P;
	    	now=now*a[2*i+1]%P;
	    	if (now<0) now+=P;
	    	ans1=(ans1+now)%P;
		}
		 for (i=0;i<=m;i++)
	    {
	    	long long now=f[m]*inv[i]%P*inv[m-i]%P;
	    	now=now*a[2*i+2]%P;
	    	if (now<0) now+=P;
	    	ans2=(ans2+now)%P;
		}
		ans1=(ans1-ans2)%P;
		if (ans1<0) ans1+=P;
		printf("%I64d\n",ans1);
	}
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#define  ms(a,b) memset(a,b,sizeof(a))

using namespace std;
typedef long long LL;
const LL INF=1e17L;
const int inf=0x3f3f3f3f;
const int maxn=2e5+5;
const int Mod=1e9+7;
LL t[maxn];
LL quick_pow(LL a,LL b)
{
    LL ans=1;
    while(b)
    {
        if(b&1) ans=ans*a%Mod;
        b>>=1;
        a=a*a%Mod;
    }
    return ans;
}

void init()
{
    t[0]=1;
    for(int i=1;i<maxn;i++)
    {
        t[i]=t[i-1]*i%Mod;
    }
}
LL C(int n,int k)
{
    LL p1=quick_pow(t[k],Mod-2);
    LL p2=quick_pow(t[n-k],Mod-2);
    return t[n]*p1%Mod*p2%Mod;
}
int n;
LL a[maxn];
int main()
{
    init();
    while(cin>>n)
    {
        for(int i=1;i<=n;i++)
            cin>>a[i];
        if(n&1)
        {
            for(int i=1;i<n;i++)
                if(i&1) a[i]=(a[i]+a[i+1])%Mod;else a[i]=(a[i]-a[i+1])%Mod;
            n--;
        }
        if(n>0)
        {
            LL ans=0,q;
            if(n%4==0) q=-1;else q=1;
            for(int i=1;i<=n;i+=2)
            {
                LL c=C(n/2-1,i/2);
                ans=(ans+c*a[i]+q*c*a[i+1])%Mod;
            }
            cout<<(ans+Mod)%Mod<<endl;
        }
        else cout<<(a[1]+Mod)%Mod<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
#define ll long long
using namespace std;
int num[maxn];
int fr[maxn];
int mod = 1000000007;
ll ksm(ll a, ll b)
{
	if(!b) return 1;
	ll ns = ksm(a, b >> 1);
	ns *= ns, ns %= mod;
	if(b & 1) ns *= a, ns %= mod;
	return ns;
}
ll jc[maxn], bjc[maxn];
ll zhs[maxn];
void work(int a)
{
	int ns = (a - 2) / 2;
	jc[0] = 1, bjc[0] = 1;
	for(int i = 1; i <= ns; i++)
		jc[i] = jc[i - 1] * i, jc[i] %= mod, bjc[i] = ksm(jc[i], mod - 2);
	for(int i = 0; i <= ns; i++)
		zhs[i] = jc[ns], zhs[i] %= mod,
		zhs[i] *= bjc[i], zhs[i] %= mod,
		zhs[i] *= bjc[ns - i], zhs[i] %= mod;
	for(int i = 1; i <= a; i++)
		num[i] = zhs[(i - 1) >> 1];
	if(ns & 1)
		for(int i = 2; i <= a; i += 2)
			num[i] = -num[i];
}
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &fr[i]);
	if(n == 1)
	{
		printf("%d\n", fr[1]);
		return 0;
	}
	if(n & 1)
	{
		work(n - 1);
		for(int i = n; i >= 1; i--)
			if(i & 1) num[i] -= num[i - 1];
			else num[i] += num[i - 1];
	}
	else work(n);
	ll ans = 0;
	for(int i = 1; i <= n; i++)
		ans += num[i] * fr[i], ans %= mod;
	if(ans < 0) ans += mod;
	printf("%I64d\n", ans);
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
#define ll long long
using namespace std;
ll num[maxn];
ll fr[maxn];
ll mod = 1000000007;
ll ksm(ll a, ll b)
{
	if(!b) return 1;
	ll ns = ksm(a, b >> 1);
	ns *= ns, ns %= mod;
	if(b & 1) ns *= a, ns %= mod;
	return ns;
}
ll jc[maxn], bjc[maxn];
ll zhs[maxn];
void work(int a)
{
	int ns = (a - 2) / 2;
	jc[0] = 1, bjc[0] = 1;
	for(int i = 1; i <= ns; i++)
		jc[i] = jc[i - 1] * i, jc[i] %= mod, bjc[i] = ksm(jc[i], mod - 2);
	for(int i = 0; i <= ns; i++)
		zhs[i] = jc[ns], zhs[i] %= mod,
		zhs[i] *= bjc[i], zhs[i] %= mod,
		zhs[i] *= bjc[ns - i], zhs[i] %= mod;
	for(int i = 1; i <= a; i++)
		num[i] = zhs[(i - 1) >> 1];
	if(ns & 1)
		for(int i = 2; i <= a; i += 2)
			num[i] = -num[i];
}
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%I64d", &fr[i]);
	if(n == 1)
	{
		printf("%d\n", fr[1]);
		return 0;
	}
	if(n & 1)
	{
		work(n - 1);
		for(int i = n; i >= 1; i--)
			if(i & 1) num[i] -= num[i - 1];
			else num[i] += num[i - 1];
	}
	else work(n);

	ll ans = 0;
	for(int i = 1; i <= n; i++)
		ans += num[i] * fr[i], ans %= mod;
	if(ans < 0) ans += mod;
	printf("%I64d\n", ans);
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 200005
#define ll long long
using namespace std;
ll num[maxn];
ll fr[maxn];
ll mod = 1000000007;
ll ksm(ll a, ll b)
{
	if(!b) return 1;
	ll ns = ksm(a, b >> 1);
	ns *= ns, ns %= mod;
	if(b & 1) ns *= a, ns %= mod;
	return ns;
}
ll jc[maxn], bjc[maxn];
ll zhs[maxn];
void work(int a)
{
	int ns = (a - 2) / 2;
	jc[0] = 1, bjc[0] = 1;
	for(int i = 1; i <= ns; i++)
		jc[i] = jc[i - 1] * i, jc[i] %= mod, bjc[i] = ksm(jc[i], mod - 2);
	for(int i = 0; i <= ns; i++)
		zhs[i] = jc[ns], zhs[i] %= mod,
		zhs[i] *= bjc[i], zhs[i] %= mod,
		zhs[i] *= bjc[ns - i], zhs[i] %= mod;
	for(int i = 1; i <= a; i++)
		num[i] = zhs[(i - 1) >> 1];
	if(ns & 1)
		for(int i = 2; i <= a; i += 2)
			num[i] = -num[i];
}
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%I64d", &fr[i]);
	if(n == 1)
	{
		printf("%d\n", fr[1]);
		return 0;
	}
	if(n & 1)
	{
		work(n - 1);
		for(int i = n; i >= 1; i--)
			if(i & 1) num[i] -= num[i - 1];
			else num[i] += num[i - 1];
	}
	else work(n);

	ll ans = 0;
	for(int i = 1; i <= n; i++)
		ans += num[i] * fr[i], ans %= mod;
	if(ans < 0) ans += mod;
	printf("%I64d\n", ans);
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
#define ll long long
using namespace std;
int num[maxn];
int fr[maxn];
int mod = 1000000007;
ll ksm(ll a, ll b)
{
	if(!b) return 1;
	ll ns = ksm(a, b >> 1);
	ns *= ns, ns %= mod;
	if(b & 1) ns *= a, ns %= mod;
	return ns;
}
ll jc[maxn], bjc[maxn];
ll zhs[maxn];
void work(int a)
{
	int ns = (a - 2) / 2;
	jc[0] = 1, bjc[0] - 1;
	for(int i = 1; i <= ns; i++)
		jc[i] = jc[i - 1] * i, jc[i] %= mod, bjc[i] = ksm(jc[i], mod - 2);
	for(int i = 0; i <= ns; i++)
		zhs[i] = jc[i] * jc[ns - i], zhs[i] %= mod,
		zhs[i] *= bjc[ns], zhs[i] %= mod;
	for(int i = 1; i <= a; i++)
		num[i] = zhs[(i - 1) >> 1];
	if(ns & 1)
		for(int i = 2; i <= a; i += 2)
			num[i] = -num[i];
}
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &fr[i]);
	if(n == 1)
	{
		printf("%d\n", fr[1]);
		return 0;
	}
	if(n & 1)
	{
		work(n - 1);
		for(int i = n; i >= 1; i--)
			if(i & 1) num[i] -= num[i - 1];
			else num[i] += num[i - 1];
	}
	else work(n);
	ll ans = 0;
	for(int i = 1; i <= n; i++)
		ans += num[i] * fr[i], ans %= mod;
	if(ans < 0) ans += mod;
	printf("%I64d\n", ans);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#define rep(i,j,k) for(register int i = j; i <= k; ++i)
#define dow(i,j,k) for(register int i = j; i >= k; --i)
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
using namespace std;

inline ll read() {
    ll s = 0, t = 1; char c = getchar();
    while( !isdigit(c) ) { if( c == '-' ) t = -1; c = getchar(); }
    while( isdigit(c) ) s = s * 10 + c - 48, c = getchar();
    return s * t;
}

const int N = 2e5+5, p = 1000000007;
inline void Max(int &x,int v) { if( v > x ) x = v; }
inline void Min(int &x,int v) { if( x > v ) x = v; }

ll v[N], fac[N] = {1}, ni[N] = {1,1};
inline ll C(int n,int m) { return fac[n] * ni[m] % p * ni[n-m] % p; }

int main() {
	int n = read(), m = n;
	if( n == 1 ) { cout<<read()<<endl; return 0; }
	rep(i,1,n) fac[i] = fac[i-1] * i % p;
	rep(i,2,n) ni[i] = (p - p / i) * ni[p % i] % p;
	rep(i,1,n) ni[i] = ni[i-1] * ni[i] % p;
	rep(i,1,n) v[i] = read();

	if( n & 1 ) {
		int flag = 1;
		rep(i,1,n-1) v[i] = (v[i] + flag * v[i+1] % p + p) % p, flag *= -1;
		n--;
	}
	ll tot = (n >> 1) - 1, a = 0, b = 0;
	for(register int i = 1, j = 0; i <= n; j++) {
		(a += C(tot,j) * v[i++]) %= p;
		(b += C(tot,j) * v[i++]) %= p;
	}
	if( m % 4 == 1 || m % 4 == 0 ) cout<<(a - b + p) % p<<endl;
	else if( m % 4 == 2 || m % 4 == 3 ) cout<<(a + b) % p<<endl;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#define rep(i,j,k) for(register int i = j; i <= k; ++i)
#define dow(i,j,k) for(register int i = j; i >= k; --i)
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
using namespace std;

inline ll read() {
    ll s = 0, t = 1; char c = getchar();
    while( !isdigit(c) ) { if( c == '-' ) t = -1; c = getchar(); }
    while( isdigit(c) ) s = s * 10 + c - 48, c = getchar();
    return s * t;
}

const int N = 2e5+5, p = 1000000007;
inline void Max(int &x,int v) { if( v > x ) x = v; }
inline void Min(int &x,int v) { if( x > v ) x = v; }

ll v[N], fac[N] = {1}, ni[N] = {1,1};
inline ll C(int n,int m) { return fac[n] * ni[m] % p * ni[n-m] % p; }

int main() {
	int n = read(), m = n;
	rep(i,1,n) fac[i] = fac[i-1] * i % p;
	rep(i,2,n) ni[i] = (p - p / i) * ni[p % i] % p;
	rep(i,1,n) ni[i] = ni[i-1] * ni[i] % p;
	rep(i,1,n) v[i] = read();

	if( n & 1 ) {
		int flag = 1;
		rep(i,1,n-1) v[i] = (v[i] + flag * v[i+1] % p + p) % p, flag *= -1;
		n--;
	}
	ll tot = (n >> 1) - 1, a = 0, b = 0;
	for(register int i = 1, j = 0; i <= n; j++) {
		(a += C(tot,j) * v[i++]) %= p;
		(b += C(tot,j) * v[i++]) %= p;
	}
	if( m % 4 == 1 || m % 4 == 0 ) cout<<(a - b + p) % p<<endl;
	else if( m % 4 == 2 || m % 4 == 3 ) cout<<(a + b) % p<<endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1;
	c[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
		f[i] = c[n / 2 - 1] * fastpow(c[i - 1] * c [n / 2 - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	//getc();
	bool ope = true;
	while (n > 0)
	{
		if (ope && n % 2 == 0)
			break;
		int t = 0;
		if (ope)
		{
			t = 1;
			ope = false;
		}
		else
		{
			t = -1;
			ope = true;
		}
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			b[i] %= MOD;
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		--n;
	}
	getc();
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = a[1];
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2 + 1] * a[i] % MOD;
		//cout << f[i] << endl;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2] * a[i] % MOD;
		temp %= MOD;
	}
	//cout << ans << " " << temp << " " << n << endl;
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1;
	c[0] = 1;
	for (int i = 1; i < n + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
		f[i] = c[n / 2 - 1] * fastpow(c[i - 1] * c [n / 2 - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	//getc();
	bool ope = true;
	while (n > 0 && !(ope && n % 2 == 0))
	{
		int t = 0;
		if (ope)
			t = 1;
		else
			t = -1;
		ope = !ope;
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			b[i] %= MOD;
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		--n;
	}
	getc();
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = a[1];
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2 + 1] * a[i] % MOD;
		//cout << f[i] << endl;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2] * a[i] % MOD;
		temp %= MOD;
	}
	//cout << ans << " " << temp << " " << n << endl;
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1;
	c[0] = 1;
	for (int i = 1; i < n + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n + 1; ++i)
		f[i] = c[n / 2 - 1] * fastpow(c[i - 1] * c [n / 2 - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	getc();
	bool ope = true;
	while (n > 0 && (!ope || n % 2 != 0))
	{
		int t = 0;
		if (ope)
			t = 1;
		else
			t = -1;
		ope = !ope;
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		--n;
	}
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = a[1];
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2 + 1] * a[i] % MOD;
		//cout << f[i] << endl;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2] * a[i] % MOD;
		temp %= MOD;
	}
	//cout << ans << " " << temp << " " << n << endl;
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1;
	c[0] = 1;
	for (int i = 1; i < n + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n + 1; ++i)
		f[i] = c[n / 2 - 1] * fastpow(c[i - 1] * c [n / 2 - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	//getc();
	bool ope = true;
	while (n > 0 && (!ope || n % 2 != 0))
	{
		int t = 0;
		if (ope)
			t = 1;
		else
			t = -1;
		ope = !ope;
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		--n;
	}
	getc();
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = a[1];
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2 + 1] * a[i] % MOD;
		//cout << f[i] << endl;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2] * a[i] % MOD;
		temp %= MOD;
	}
	//cout << ans << " " << temp << " " << n << endl;
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1;
	c[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
		f[i] = c[n / 2 - 1] * fastpow(c[i - 1] * c [n / 2 - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	//getc();
	bool ope = true;
	while (n > 0)
	{
		if (ope && n % 2 == 0)
			break;
		int t = 0;
		if (ope)
			t = 1;
		else
			t = -1;
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			b[i] %= MOD;
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		if (t == 1)
			ope = true;
		else
			ope = false;
		--n;
	}
	getc();
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = a[1];
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2 + 1] * a[i] % MOD;
		//cout << f[i] << endl;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2] * a[i] % MOD;
		temp %= MOD;
	}
	//cout << ans << " " << temp << " " << n << endl;
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1, div = 1;
	c[0] = 1;
	for (int i = 1; i < n + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n + 1; ++i)
		f[i] = c[n - 1] * fastpow(c[i - 1] * c [n - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	getc();
	bool ope = true;
	while (n > 0 && (!ope || n % 2 != 0))
	{
		int t = 0;
		if (ope)
			t = 1;
		else
			t = -1;
		ope = !ope;
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		--n;
	}
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = a[1];
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2] * a[i] % MOD;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2 - 1] * a[i] % MOD;
		temp %= MOD;
	}
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%I64d\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1;
	c[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
		f[i] = c[n / 2 - 1] * fastpow(c[i - 1] * c [n / 2 - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	//getc();
	bool ope = true;
	while (n > 0)
	{
		if (ope && n % 2 == 0)
			break;
		int t = 0;
		if (ope)
			t = 1;
		else
			t = -1;
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			b[i] = (b[i] + MOD) % MOD;
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		if (t == 1)
			ope = true;
		else
			ope = false;
		--n;
	}
	getc();
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = (a[1] + MOD) % MOD;
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2 + 1] * a[i] % MOD;
		//cout << f[i] << endl;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2] * a[i] % MOD;
		temp %= MOD;
	}
	//cout << ans << " " << temp << " " << n << endl;
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
using namespace std;

const int MAXN = 200000 + 100, MOD = 1e9 + 7;
int n;
long long a[MAXN], b[MAXN], c[MAXN], f[MAXN];

inline long long fastpow(long long x, long long y)
{
	long long ret = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
			ret = ret * x % MOD;
		x = x * x % MOD;
		y /= 2;
	}
	return ret % MOD;
}

void getc()
{
	long long base = 1;
	c[0] = 1;
	for (int i = 1; i < n + 1; ++i)
	{
		base = base * i % MOD;// (n - 1)!/(k - 1)!(n - k)!
		c[i] = base;
	}
	f[0] = 1;
	for (int i = 1; i < n / 2 + 1; ++i)
		f[i] = c[n / 2 - 1] * fastpow(c[i - 1] * c [n / 2 - i] % MOD, MOD - 2) % MOD;
	return;
}

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

int main()
{
	n = read();
	for (int i = 1; i < n + 1; ++i)
		a[i] = read();
	//getc();
	bool ope = true;
	while (n > 0)
	{
		if (ope && n % 2 == 0)
			break;
		int t = 0;
		if (ope)
			t = 1;
		else
			t = -1;
		ope = !ope;
		for (int i = 1; i < n; ++i)
		{
			b[i] = a[i] + t * a[i + 1];
			b[i] %= MOD;
			if (t == 1)
				t = -1;
			else
				t = 1;
		}
		for (int i = 1; i < n; ++i)
			a[i] = b[i];
		--n;
	}
	getc();
	long long ans = 0, temp = 0;
	if (n == 0)
		ans = a[1];
	for (int i = 1; i < n + 1; i += 2)
	{
		ans += f[i / 2 + 1] * a[i] % MOD;
		//cout << f[i] << endl;
		ans %= MOD;
	}
	for (int i = 2; i < n + 1; i += 2)
	{
		temp += f[i / 2] * a[i] % MOD;
		temp %= MOD;
	}
	//cout << ans << " " << temp << " " << n << endl;
	if (n % 4 == 2)
		ans = (ans + temp) % MOD;
	else
		ans = (ans - temp + MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>

#define MAXN 210000
#define MOD 1000000007

using namespace std;

typedef long long int LL;

LL init[MAXN],a[MAXN],rev[MAXN],fact[MAXN];

void getRev()
{
    rev[1]=1;
    for(int i=2;i<MAXN;i++)
    {
        rev[i]=-(LL)(MOD/i)*rev[MOD%i]%MOD;
        if(rev[i]<0) rev[i]+=MOD;
    }
}

LL C(int a,int b)
{
    //printf("%d %d %I64d %I64d\n",a,b,fact[a],rev[fact[b]*fact[a-b]%MOD]);
    //printf("dbg2: C(%d,%d)=%I64d\n",a,b,fact[a]*rev[fact[b]*fact[a-b]%MOD]%MOD);
    return fact[a]*rev[fact[b]*fact[a-b]%MOD]%MOD;
}

void solve(int n)
{
    LL ans=0,sum1=0,sum2=0;
    int N=n/2-1;
    for(int i=1,id=0;i<=n;i+=2,id++)
        sum1=(sum1+C(N,id)*a[i]%MOD)%MOD;
    for(int i=2,id=0;i<=n;i+=2,id++)
        sum2=(sum2+C(N,id)*a[i]%MOD)%MOD;
    //printf("dbg: %I64d %I64d\n",sum1,sum2);
    if(n%4==2)
        ans=((sum1+sum2)%MOD+MOD)%MOD;
    else
        ans=((sum1-sum2)%MOD+MOD)%MOD;
    printf("%I64d\n",ans);
}

int main()
{
    int n;
    fact[0]=1;
    for(int i=1;i<MAXN;i++)
        fact[i]=fact[i-1]*(LL)i%MOD;
    getRev();
    //for(int i=1;i<=100;i++)
    //    printf("dbg: %I64d\n",rev[i]*(LL)i%MOD);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%I64d",&init[i]);
    if(n==1)
    {
        printf("%d\n",init[1]);
        return 0;
    }
    else if(n%2==0)
    {
        for(int i=1;i<=n;i++) a[i]=init[i];
        solve(n);
    }
    else
    {
        for(int i=1;i<n;i++)
        {
            if(i%2==1)
                a[i]=init[i]+init[i+1];
            else
                a[i]=init[i]-init[i+1];
        }
        solve(n-1);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>

#define MAXN 210000
#define MOD 1000000007

using namespace std;

typedef long long int LL;

LL init[MAXN],a[MAXN],fact[MAXN];

LL fastPow(LL base,int pow)
{
    LL ans=1;
    while(pow)
    {
        if(pow&1) ans=ans*base%MOD;
        base=base*base%MOD;
        pow>>=1;
    }
    return ans;
}

LL C(int a,int b)
{
    //printf("%d %d %I64d %I64d\n",a,b,fact[a],rev[fact[b]*fact[a-b]%MOD]);
    //printf("dbg2: C(%d,%d)=%I64d\n",a,b,fact[a]*rev[fact[b]*fact[a-b]%MOD]%MOD);
    return fact[a]*fastPow(fact[b]*fact[a-b]%MOD,MOD-2)%MOD;
}

void solve(int n)
{
    LL ans=0,sum1=0,sum2=0;
    int N=n/2-1;
    for(int i=1,id=0;i<=n;i+=2,id++)
        sum1=(sum1+C(N,id)*a[i]%MOD)%MOD;
    for(int i=2,id=0;i<=n;i+=2,id++)
        sum2=(sum2+C(N,id)*a[i]%MOD)%MOD;
    //printf("dbg: %I64d %I64d\n",sum1,sum2);
    if(n%4==2)
        ans=((sum1+sum2)%MOD+MOD)%MOD;
    else
        ans=((sum1-sum2)%MOD+MOD)%MOD;
    printf("%I64d\n",ans);
}

int main()
{
    int n;
    fact[0]=1;
    for(int i=1;i<MAXN;i++)
        fact[i]=fact[i-1]*(LL)i%MOD;
    //for(int i=1;i<=100;i++)
    //    printf("dbg: %I64d\n",rev[i]*(LL)i%MOD);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%I64d",&init[i]);
    if(n==1)
    {
        printf("%I64d\n",init[1]);
        return 0;
    }
    else if(n%2==0)
    {
        for(int i=1;i<=n;i++) a[i]=init[i];
        solve(n);
    }
    else
    {
        for(int i=1;i<n;i++)
        {
            if(i%2==1)
                a[i]=init[i]+init[i+1];
            else
                a[i]=init[i]-init[i+1];
        }
        solve(n-1);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>

#define MAXN 210000
#define MOD 1000000007

using namespace std;

typedef long long int LL;

LL init[MAXN],a[MAXN],rev[MAXN],fact[MAXN];

void getRev()
{
    rev[1]=1;
    for(int i=2;i<MAXN;i++)
    {
        rev[i]=-(LL)(MOD/i)*rev[MOD%i]%MOD;
        if(rev[i]<0) rev[i]+=MOD;
    }
}

LL C(int a,int b)
{
    //printf("%d %d %I64d %I64d\n",a,b,fact[a],rev[fact[b]*fact[a-b]%MOD]);
    //printf("dbg2: C(%d,%d)=%I64d\n",a,b,fact[a]*rev[fact[b]*fact[a-b]%MOD]%MOD);
    return fact[a]*rev[fact[b]*fact[a-b]%MOD]%MOD;
}

void solve(int n)
{
    LL ans=0,sum1=0,sum2=0;
    int N=n/2-1;
    for(int i=1,id=0;i<=n;i+=2,id++)
        sum1=(sum1+C(N,id)*a[i]%MOD)%MOD;
    for(int i=2,id=0;i<=n;i+=2,id++)
        sum2=(sum2+C(N,id)*a[i]%MOD)%MOD;
    //printf("dbg: %I64d %I64d\n",sum1,sum2);
    if(n%4==2)
        ans=((sum1+sum2)%MOD+MOD)%MOD;
    else
        ans=((sum1-sum2)%MOD+MOD)%MOD;
    printf("%I64d\n",ans);
}

int main()
{
    int n;
    fact[0]=1;
    for(int i=1;i<MAXN;i++)
        fact[i]=fact[i-1]*(LL)i%MOD;
    getRev();
    //for(int i=1;i<=100;i++)
    //    printf("dbg: %I64d\n",rev[i]*(LL)i%MOD);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%I64d",&init[i]);
    if(n%2==0)
    {
        for(int i=1;i<=n;i++) a[i]=init[i];
        solve(n);
    }
    else
    {
        for(int i=1;i<n;i++)
        {
            if(i%2==1)
                a[i]=init[i]+init[i+1];
            else
                a[i]=init[i]-init[i+1];
        }
        solve(n-1);
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<queue>
#include<map>
#include<vector>
#include<ctime>
#include<set>

#define ll long long
#define R register
#define IL inline
#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))
#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))
#define MP make_pair
#define PA pair<int,int>
#define MES(a,b) memset((a),(b),sizeof((a)))
#define MEC(a,b) memcpy((a),(b),sizeof((b)))
#define D double

using namespace std;

const int N=200005,mod=1e9+7;

ll n,a[N],fc[N],inv[N],fi[N],ans;

IL int read() {
    int x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}
    return x*f;
}
IL void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

IL ll cal(int x,int y) {return fc[x]*fi[x-y]%mod*fi[y]%mod;}

signed main()
{
	fc[0]=fc[1]=inv[0]=inv[1]=fi[0]=fi[1]=1;
	Rf(i,2,N-5) {
		fc[i]=fc[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		fi[i]=fi[i-1]*inv[i]%mod;
	}
	n=read();
	Rf(i,1,n) a[i]=read();
	if(n<=2) {
		write((a[1]+a[2])%mod);
		putchar('\n');
		return 0;
	}
	if(n&1) {
		R int t=1;
		Rf(i,1,n-1) {
			a[i]=a[i]+a[i+1]*t;
			t*=-1;
		}
		n--;
	}
	R int t;
	if(n%4) t=1;
	else t=-1;
	Rf(i,1,n) {
		R ll tmp=cal(n/2-1,i/2);
		ans=(ans+(a[i]+a[i+1]*t)*tmp+mod)%mod;
		i++;
	}
	write(ans);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<queue>
#include<map>
#include<vector>
#include<ctime>
#include<set>

#define ll long long
#define R register
#define IL inline
#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))
#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))
#define MP make_pair
#define PA pair<int,int>
#define MES(a,b) memset((a),(b),sizeof((a)))
#define MEC(a,b) memcpy((a),(b),sizeof((b)))
#define D double

using namespace std;

const int N=200005,mod=1e9+7;

int n,a[2][N],f,p,cnt;

IL int read() {
    int x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}
    return x*f;
}
IL void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

signed main()
{
	n=read();
	Rf(i,1,n) a[1][i]=read();
	while(n>1) {
		Rf(i,2,n) {
			if(f) a[p][++cnt]=(a[p^1][i-1]-a[p^1][i]+mod)%mod;
			else a[p][++cnt]=(a[p^1][i-1]+a[p^1][i])%mod;
			f^=1;
		}
		p^=1;
		n=cnt;cnt=0;
	}
	write(a[p^1][1]);

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<queue>
#include<map>
#include<vector>
#include<ctime>
#include<set>

#define ll long long
#define R register
#define IL inline
#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))
#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))
#define MP make_pair
#define PA pair<int,int>
#define MES(a,b) memset((a),(b),sizeof((a)))
#define MEC(a,b) memcpy((a),(b),sizeof((b)))
#define D double

using namespace std;

const int N=200005,mod=1e9+7;

ll n,a[N],fc[N],inv[N],fi[N],ans;

IL int read() {
    int x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}
    return x*f;
}
IL void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

IL ll cal(int x,int y) {return fc[x]*fi[x-y]%mod*fi[y]%mod;}

signed main()
{
	fc[0]=fc[1]=inv[0]=inv[1]=fi[0]=fi[1]=1;
	Rf(i,2,N-5) {
		fc[i]=fc[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		fi[i]=fi[i-1]*inv[i]%mod;
	}
	n=read();
	Rf(i,1,n) a[i]=read();
	if(n<=2) {
		write((a[1]+a[2])%mod);
		putchar('\n');
		return 0;
	}
	if(n&1) {
		R int t=1;
		Rf(i,1,n-1) {
			a[i]=a[i]+a[i+1]*t;
			t*=-1;
		}
		n--;
	}
	R int t;
	if(n%4) t=1;
	else t=-1;
	Rf(i,1,n) {
		R ll tmp=cal(n/2-1,i/2);
		ans=(ans+(a[i]+a[i+1]*t)*tmp+mod)%mod;
		i++;
	}
	write((ans+mod)%mod);
    return 0;
}


#include <cstdio>
typedef long long int64;
static const int MAXN = 200004;
static const int MODULUS = 1e9 + 7;
#define _  %  MODULUS
#define __ %= MODULUS

int n;
int a[MAXN], b[MAXN];

int64 fact[MAXN], fact_inv[MAXN];

inline int64 fpow(int64 base, int exp)
{
    int64 ans = 1;
    for (; exp; exp >>= 1, (base *= base)__) if (exp & 1) (ans *= base)__;
    return ans;
}

inline void preprocess()
{
    fact[0] = fact_inv[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fact[i] = fact[i - 1] * i _;
        fact_inv[i] = fpow(fact[i], MODULUS - 2);
    }
}

inline int64 binom(int n, int m)
{
    if (n < m) return 0;
    return fact[n] * fact_inv[m]_ * fact_inv[n - m]_;
}

int main()
{
    preprocess();

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);

    int w = (n - 1) / 2;
    if (n % 4 == 1) {
        for (int i = 0; i < n; ++i)
            b[i] = i % 2 == 0 ? binom(w, i / 2) : 0;
    } else if (n % 4 == 2) {
        for (int i = 0; i < n; ++i)
            b[i] = binom(w, i / 2);
    } else if (n % 4 == 3) {
        b[0] = 1;
        for (int i = 1; i < n; ++i)
            b[i] = (b[i - 1] * (i % 2 == 0 ? -1 : +1) + binom(w, i / 2))_;
    } else {
        for (int i = 0; i < n; ++i)
            b[i] = binom(w, i / 2) * (i % 2 == 0 ? +1 : -1);
    }

    int64 ans = 0;
    for (int i = 0; i < n; ++i) (ans += (int64)a[i] * b[i])__;
    printf("%d\n", (int)(ans + MODULUS)_);

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define maxn 200111
typedef long long ll;
const ll mod=1000000007;
ll a[maxn];
ll fac[maxn],inv[maxn];
int n;

ll Pow(ll x,ll y)
{
	ll res=1,t=x;
	for(;y;y>>=1,t=t*t%mod)
		if (y&1) res=res*t%mod;
	return res;
}

ll Inv(ll x)
{
	return Pow(x,mod-2);
}

ll C(ll n,ll m)
{
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%I64d",a+i);

	int op=0;
	while (n%4!=1)
	{
		for(int i=1;i<n;i++)
		{
			if (op==0) a[i]=(a[i]+a[i+1])%mod;
			else a[i]=(a[i]+mod-a[i+1])%mod;
			op^=1;
		}
		a[n]=0;
		n--;
	}

	if (n==1)
	{
		printf("%I64d\n",a[1]);
		return 0;
	}

	int k=n/4;
	int p=k*2;

	fac[0]=1;
	for(int i=1;i<=p;i++) fac[i]=fac[i-1]*i%mod;
	for(int i=0;i<=p;i++) inv[i]=Inv(fac[i]);

	ll res=0;
	for(int i=1,j=0;i<=n;i+=2,j++)
	{
		res+=a[i]*C(p,j)%mod;
		res%=mod;
	}

	printf("%I64d\n",res);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 5, mod = 1e9 + 7;

long long powmod(long long b, long long p) {
    long long r = 1;
    for (; p; p >>= 1, b = b * b % mod)
        if (p & 1) r = r * b % mod;
    return r;
}

long long fac[N], inv[N];

long long C(int n, int k) {
    if (n < 0 || k > n || k < 0) return 0;
    return (fac[n] * inv[k] % mod) * inv[n-k] % mod;
}

int a[N];
long long b[N], c[N];

int main() {
    fac[0] = inv[0] = 1;
    for (int i = 1; i < N; i++) {
        fac[i] = fac[i-1] * i % mod;
        inv[i] = powmod(fac[i], mod-2);
    }
    int n;
    scanf("%d", &n);
    int k = n/2-1;
    for (int i = 0; i <= k; i++) {
        long long cnk = C(k, i);
        b[i * 2] = cnk;
        b[i * 2 + 1] = k & 1 ? -cnk : cnk;
    }
    k = 2 * k + 2;
    if (k < n) {
        for (int i = 0; i < k; i++)
            c[i] = b[i];
        memset(b, 0, sizeof b);
        for (int i = 0; i < k; i++) {
            b[i] += c[i];
            if (i & 1)
                b[i+1] -= c[i];
            else
                b[i+1] += c[i];
        }
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", a+i);
    }
    if (n == 1) {
        printf("%d\n", a[0]);
        return 0;
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        b[i] %= mod;
        ans = (ans + 1LL * a[i] * b[i]) % mod;
    }
    ans %= mod;
    if (ans < 0)
        ans += mod;
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

#define Rep(i,n) for(int i=0;i<(n);++i)
#define Repd(i,n) for(int i=((int)(n))-1;i>=0;--i)
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Ford(i,a,b) for(int i=(a);i>=(b);--i)
#define Foreach(i,c) for(typeof(c.begin()) it=c.begin();it!=c.end();++it)
#define fi first
#define se second
#define pb push_back
#define MP make_pair

typedef pair<int,int> PII;
typedef vector<int> VI;

#define debug cout << "Here " << __LINE__ << endl;
template <typename T> ostream& operator<<(ostream &os, vector<T> v) { Rep(i, v.size()) os << v[i] << " "; os << endl; return os; }
template <typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.fi << ", " << p.se << ")"; return os; }

const int mod = 1000000007;
long long fact[200020];

int n;
long long a[200020];
long long newa[200020];

long long P(long long x, int y) {
    if (y == 0) return 1;
    else {
        long long a = P(x, y / 2);
        if (y % 2 == 0) return (a * a) % mod;
        else return (a * a) % mod * x % mod;
    }
}

long long F(int k, int n) {
    long long res = fact[n];
    res = res * P(fact[k], mod - 2) % mod;
    res = res * P(fact[n-k], mod - 2) % mod;
    return res;
}

int main() {
    cout.sync_with_stdio(false);
    cin >> n;
    Rep(i, n) cin >> a[i];
    Rep(i, n) a[i] = (a[i] % mod + mod) % mod;

    fact[0] = 1;
    For(i, 1, n) fact[i] = (fact[i - 1] * i) % mod;

    bool add = true;

    while (n % 4 != 1) {
        memset(newa, 0, sizeof(newa));
        Rep(i, n - 1) {
            if (add) {
                newa[i] = a[i] + a[i + 1];
            } else {
                newa[i] = a[i] - a[i + 1];
            }
            add = !add;
        }
        Rep(i, n) a[i] = (newa[i] % mod + mod) % mod;
        --n;
    }

    int k = n / 4;
    int m = 2 * k;

    long long res = 0;

    Rep(i, n) {
        if (i % 2 != 0) {}
        else {
            long long t = a[i] * F(i / 2, m) % mod;
            res = ((res + t) % mod + mod) % mod;
        }
    }

    res = (res % mod + mod) % mod;
    cout << res << endl;

    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>

#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

/*
note:

mod 4 = 0 : +, -, C(n / 2, i)
*/

const int N = 200010, Mod = 1e9 + 7;

typedef long long LL;

LL Pow(LL x, LL e){
	LL ret = 1;
	while(e){
		if(e & 1) ret = ret * x % Mod;
		x = x * x % Mod;
		e >>= 1;
	}
	return ret;
}

void Calc(LL* A, int x){
	A[0] = 1;
	For(i, 1, x) A[i] = A[i - 1] * (x - i + 1) % Mod * Pow(i, Mod - 2) % Mod;
}

LL C[N], val[N];
int n;

void run(){
	if(n % 4 == 1){
		Calc(C, n / 2);
		For(i, 0, n / 2) val[i * 2 + 1] = C[i];
	}
	else if(n % 4 == 2){
		Calc(C, n / 2 - 1);
		For(i, 0, n / 2) val[i * 2 + 1] = val[i * 2 + 2] = C[i];
	}
	else if(n % 4 == 0){
		Calc(C, n / 2 - 1);
		For(i, 0, n / 2) val[i * 2 + 1] = C[i], val[i * 2 + 2] = -C[i];
	}
	else{
		Calc(C, n / 2 - 1);
		For(i, 1, n / 2) val[i * 2] = (C[i - 1] * 2) % Mod;
		Calc(C, n / 2);
		For(i, 0, n / 4) val[i * 2 + 1] = (C[i] - val[i * 2] + Mod) % Mod, val[n - i * 2] = (Mod - val[i * 2 + 1]) % Mod;
	}
	For(i, 1, n) val[i] = (val[i] + Mod) % Mod;
}

int A[N];

int main(){
	scanf("%d", &n);
	run();
	int ans = 0;
	For(i, 1, n) scanf("%d", &A[i]), ans = (ans + 1LL * A[i] * val[i] % Mod) % Mod;
	printf("%d\n", (ans + Mod) % Mod);
	/*
	For(i, 1, n) coe[1][i][i] = 1;
	int sig = 1;
	For(i, 2, n){
		For(j, 1, n - i + 1){
			For(k, 1, n) coe[i][j][k] = coe[i - 1][j][k] + sig * coe[i - 1][j + 1][k];
			sig = -sig;
		}
	}
	For(i, 1, n) printf("%d%c", coe[n][1][i], i == n ? '\n' : ' ');
	*/
	return 0;
}


#include <stdio.h>
#include <algorithm>

using namespace std;

//long long
const long long NN = 220000;
const long long mod = 1000000007;
long long n;
long long fact[NN] , rev[NN];
long long a[NN];
long long ans;
long long pow ( long long f , long long x ) {
	long long s = 1;
	while ( x ) {
		if ( x % 2 == 1 ) s = (s*f) % mod;
		f = (f*f) % mod; x >>= 1;
	}
	return s;
}
void predo () {
	long long i;
	fact[0] = 1;
	rev[0] = 1;
	for ( i = 1 ; i <= 200000 ; i++ ) {
		fact[i] = (fact[i-1]*i) % mod;
	}
	rev[200000] = pow ( fact[200000] , mod - 2 );
	for ( i = 200000 - 1 ; i >= 1 ; i-- ) {
		rev[i] = (rev[i+1] * (i+1)) % mod;
	}
}
long long C ( long long a , long long b ) {
	if ( b < 0 ) return 0;
	//printf ( "%Id\n" ,b );
	return (fact[a]*((rev[b]*rev[a-b])%mod)) % mod;
}
void work () {
	long long i , co , x , y;
	scanf ( "%I64d" , &n );
	for ( i = 1 ; i <= n ; i++ ) {
		scanf ( "%I64d" , &a[i] );
		x = n - 1; y = n - 1 - i + 1;
		if ( n % 2 == 0 ) {
			co = C(x/2,(y)/2);
			if ( x % 4 == 3 && y % 2 == 0 ) co = (mod - co);
		}
		else {
			if ( n % 4 == 1 ) {
				if ( i % 2 == 0 ) co = 0;
				else co = C(x/2,(i-1)/2);
			}
			else {
				if ( i % 2 == 0 ) {
					co = (2*C((n-3)/2,(i-2)/2)) % mod;
				}
				else {
					co = (  C((n-3)/2,i/2) - C((n-3)/2,i/2-1) + mod  ) %mod;
					//printf ( "      %I64d %I64d %I64d\n" ,C((n-3)/2,i/2), C((n-3)/2 , i/2-1) , co  );
				}
			}
		}
		//printf ( "%I64d\n" , co );
		ans = (ans + a[i] * co) % mod;
	}
	printf ( "%I64d\n" , ans );
}
int main () {
	predo ();
	work ();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define mod 1000000007
int n;
ll a[200005];
ll modpow(ll x,ll n)
{
	ll res=1;
	while(n>0)
	{
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
ll F[300005],R[300005];
void make(){
	F[0] = 1;
	for(int i=1;i<300005;i++) F[i] = F[i-1]*i%mod;
	for(int i=0;i<300005;i++) R[i] = modpow(F[i],mod-2);
}
ll C(int a,int b){
	return F[a]*R[b]%mod*R[a-b]%mod;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	int m = (n-1)/4; m *= 4; make();
	vector<ll>hoge;
	if(m > 0){
		for(int i=1;i<=4;i++){
			if(i+m > n) break;
			int x = m/2,y = 0;
			ll v = 0;
			for(int j=i;j<=i+m;j+=2){
				v = (v+C(x,y)*a[j]%mod)%mod;
				y++;
			}
			hoge.pb(v);
		}
	}
	else{
		for(int i=1;i<=n;i++) hoge.pb(a[i]);
	}int C = 0;
	while(hoge.size() > 1){
		vector<ll>hoge2;
		for(int i=1;i<hoge.size();i++){
			if(C%2 == 0){
				hoge2.pb( (hoge[i-1]+hoge[i])%mod );
			}
			else{
				hoge2.pb( (hoge[i-1]+mod-hoge[i])%mod );
			}C++;
		}
		hoge = hoge2;
	}
	cout << hoge[0] << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
const int MAXN = 200005;
const LL MOD = 1000000007LL;

int n; LL f[MAXN], inv[MAXN], cof[MAXN], cof_[MAXN];

inline LL C(int a, int b){return (f[a] * inv[b] % MOD) * inv[a - b] % MOD;}
int main(){
	int i, k, t; LL sum = 0LL;
	scanf("%d", &n);
	f[0] = inv[0] = f[1] = inv[1] = 1;
	for(i = 2; i <= n; ++ i){
		f[i] = f[i - 1] * i % MOD;
		inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
	}
	for(i = 2; i <= n; ++ i)
		(inv[i] *= inv[i - 1]) %= MOD;
	k = n >> 2;
	switch(n % 4){
		case 0:
			for(i = 0; i < 2 * k; ++ i){
				cof[i * 2 + 1] = C(2 * k - 1, i);
				cof[i * 2 + 2] = (MOD - cof[i * 2 + 1]) % MOD;
			} break;
		case 1:
			for(i = 0; i <= 2 * k; ++ i){
				cof[i * 2 + 1] = C(2 * k, i);
				cof[i * 2 + 2] = 0;
			} break;
		case 2:
			for(i = 0; i <= 2 * k; ++ i)
				cof[i * 2 + 1] = cof[i * 2 + 2] = C(2 * k, i);
			break;
		case 3:
			for(i = 0; i <= 2 * k; ++ i)
				cof_[i * 2 + 1] = cof_[i * 2 + 2] = C(2 * k, i);
			cof_[n] = 0, cof[1] = 1;
			for(i = 2; i <= n; ++ i)
				if(i & 1) cof[i] = (cof_[i] - cof_[i - 1] + MOD) % MOD;
				else cof[i] = (cof_[i] + cof_[i - 1]) % MOD;
			break;
	}
	for(i = 1; i <= n; ++ i){
		scanf("%d", &t);
		sum = (sum + cof[i] * t) % MOD;
	} cout << sum << endl;
}


#include <bits/stdc++.h>

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define ins insert
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define files(name) fin(name".in"); fout(name".out")
#define endl "\n"
#define fi(st,n) for (int i = (st); i <= (int)(n); ++i)
#define fj(st,n) for (int j = (st); j <= (int)(n); ++j)
#define fk(st,n) for (int k = (st); k <= (int)(n); ++k)
#define fq(st,n) for (int q = (st); q <= (int)(n); ++q)
#define fw(st,n) for (int w = (st); w <= (int)(n); ++w)
#define ff(i, st, n) for (int (i) = (st); (i) <= (int)(n); ++(i))
#define ei(st,n) for (int i = (st); i >= (int)(n); --i)
#define ej(st,n) for (int j = (st); j >= (int)(n); --j)
#define ek(st,n) for (int k = (st); k >= (int)(n); --k)
#define ef(i, st, n) for (int (i) = (st); (i) >= (int)(n); --(i))
#define ri(st,n) for (int i = (st); i < (int)(n); ++i)
#define rj(st,n) for (int j = (st); j < (int)(n); ++j)
#define rk(st,n) for (int k = (st); k < (int)(n); ++k)
#define rq(st,n) for (int q = (st); q < (int)(n); ++q)
#define rf(i, st, n) for (int (i) = (st); (i) < (int)(n); ++(i))
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define y1 dsklmlvmd

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const dbl eps = (dbl) 1e-8;
const int mod = (int) 1e9 + 7;
const int maxn = (int) 2e5 + 5;
//const dbl M_PI = (dbl)2 * (dbl)acos(0);

//cout<<fixed<<setprecision(10);
//srand(time(0));

ll a[maxn], fact[maxn], inv[maxn];
int n, fl;

int mpow(int x, int y)
{
	if (y == 0)
		return 1;
	if (y & 1)
	{
		return (ll)x * mpow(x, y - 1) % mod;
	}
	else
	{
		x = mpow(x, y / 2);
		return (ll)x * x % mod;
	}
}

int cnk(int n, int k)
{
	return (ll)fact[n] * inv[k] % mod * inv[n - k] % mod;
}

int main()
{
//    fin("t.in");
    sync;
    cin >> n;
    fi(1, n)
    {
    	cin >> a[i];
    }
    fact[0] = 1;
    inv[0] = 1;
    fi(1, n)
    {
    	fact[i] = ((ll)fact[i - 1] * i) % mod;
    	inv[i] = mpow(fact[i], mod - 2);
    }
    ll ans = 0;
    if (n % 4 == 0)
    {
    	fi(1, n)
    	{
    		if (i & 1)
	    		ans += a[i] * cnk((n - 2) / 2, (i - 1) / 2);
	    	else
	    		ans -= a[i] * cnk((n - 2) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }
    else
    if (n % 4 == 1)
    {
    	fi(1, n)
    	{
    		if (i & 1)
	    		ans += a[i] * cnk((n - 1) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }
    else
    if (n % 4 == 2)
    {
    	fi(1, n)
    	{
    		ans += a[i] * cnk((n - 2) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }
    else
    if (n % 4 == 3)
    {
    	ans = a[1] * cnk((n - 3) / 2, 0);
    	fi(2, n)
    	{
    		if (i & 1)
	    		ans += a[i] * ( cnk((n - 3) / 2, (i - 1) / 2) -
	    						cnk((n - 3) / 2, (i - 3) / 2));
	    	else
	    		ans -= 2ll * a[i] * cnk((n - 3) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define ins insert
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define files(name) fin(name".in"); fout(name".out")
#define endl "\n"
#define fi(st,n) for (int i = (st); i <= (int)(n); ++i)
#define fj(st,n) for (int j = (st); j <= (int)(n); ++j)
#define fk(st,n) for (int k = (st); k <= (int)(n); ++k)
#define fq(st,n) for (int q = (st); q <= (int)(n); ++q)
#define fw(st,n) for (int w = (st); w <= (int)(n); ++w)
#define ff(i, st, n) for (int (i) = (st); (i) <= (int)(n); ++(i))
#define ei(st,n) for (int i = (st); i >= (int)(n); --i)
#define ej(st,n) for (int j = (st); j >= (int)(n); --j)
#define ek(st,n) for (int k = (st); k >= (int)(n); --k)
#define ef(i, st, n) for (int (i) = (st); (i) >= (int)(n); --(i))
#define ri(st,n) for (int i = (st); i < (int)(n); ++i)
#define rj(st,n) for (int j = (st); j < (int)(n); ++j)
#define rk(st,n) for (int k = (st); k < (int)(n); ++k)
#define rq(st,n) for (int q = (st); q < (int)(n); ++q)
#define rf(i, st, n) for (int (i) = (st); (i) < (int)(n); ++(i))
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define y1 dsklmlvmd
#define int ll

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const dbl eps = (dbl) 1e-8;
const int mod = (int) 1e9 + 7;
const int maxn = (int) 2e5 + 5;
//const dbl M_PI = (dbl)2 * (dbl)acos(0);

//cout<<fixed<<setprecision(10);
//srand(time(0));

ll a[maxn], fact[maxn], inv[maxn];
int n, fl;

int mpow(int x, int y)
{
	if (y == 0)
		return 1;
	if (y & 1)
	{
		return (ll)x * mpow(x, y - 1) % mod;
	}
	else
	{
		x = mpow(x, y / 2);
		return (ll)x * x % mod;
	}
}

int cnk(int n, int k)
{
	return (ll)fact[n] * inv[k] % mod * inv[n - k] % mod;
}

signed main()
{
//    fin("t.in");
    sync;
    cin >> n;
    fi(1, n)
    {
    	cin >> a[i];
    }
    fact[0] = 1;
    inv[0] = 1;
    fi(1, n)
    {
    	fact[i] = ((ll)fact[i - 1] * i) % mod;
    	inv[i] = mpow(fact[i], mod - 2);
    }
    ll ans = 0;
    if (n % 4 == 0)
    {
    	fi(1, n)
    	{
    		if (i & 1)
	    		ans += a[i] * cnk((n - 2) / 2, (i - 1) / 2);
	    	else
	    		ans -= a[i] * cnk((n - 2) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }
    else
    if (n % 4 == 1)
    {
    	fi(1, n)
    	{
    		if (i & 1)
	    		ans += a[i] * cnk((n - 1) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }
    else
    if (n % 4 == 2)
    {
    	fi(1, n)
    	{
    		ans += a[i] * cnk((n - 2) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }
    else
    if (n % 4 == 3)
    {
    	ans = a[1] * cnk((n - 3) / 2, 0);
    	fi(2, n)
    	{
    		if (i & 1)
	    		ans += a[i] * ( cnk((n - 3) / 2, (i - 1) / 2) -
	    						cnk((n - 3) / 2, (i - 3) / 2));
	    	else
	    		ans += 2ll * a[i] * cnk((n - 3) / 2, (i - 1) / 2);
    		ans = (ans % mod + mod) % mod;
    	}
    }

    cout << ans << endl;
    return 0;
}


#include <cstdio>
#include <iostream>
#define N 200002
#define P 1000000007
using namespace std;
int n,a[N];
long long jc[N],ni[N],b[N],c[N],d[N];
long long pow(long long x,int y){
	long long res=1;
	for(;y;y>>=1,x=x*x%P)
	    if(y&1)res=res*x%P;
	return res;
}
long long C(int x,int y){
	return jc[x]*ni[y]%P*ni[x-y]%P;
}
int main(){
	jc[0]=1;
	for(int i=1;i<N;++i)jc[i]=jc[i-1]*i%P;
	for(int i=0;i<N;++i)ni[i]=pow(jc[i],P-2);
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	if(n&1){
		int k=1;
		while(k+4<=n)k+=4;
		for(int i=0;i<=k/2;++i)b[i]=C(k/2,i);
		for(int i=1;i<=n+1-k;++i)
			for(int j=0;j<=k/2;++j)c[i]=(c[i]+b[j]*a[i+j*2]%P)%P;
	    for(++k;k<=n;++k)
	    	if(k%4<2)for(int i=1,j=-1;i<=n+1-k;++i,j=-j)c[i]=(c[i]+c[i+1]*j+P)%P;
	    	else for(int i=1,j=1;i<=n+1-k;++i,j=-j)c[i]=(c[i]+c[i+1]*j+P)%P;
	    printf("%I64d",c[1]);
	}
	else{
		int k=n-1;
		for(int i=0;i<=k/2;++i)b[i]=C(k/2,i);
		for(int i=1;i<=2;++i)
	        for(int j=0;j<=k/2;++j)c[i]=(c[i]+b[j]*a[i+j*2]%P)%P;
		if(n%4)printf("%I64d",(c[1]+c[2])%P);
		else printf("%I64d",(c[1]-c[2]+P)%P);
	}
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cassert>

using namespace std;

const int K = 1e9 + 7;
int n, a[201010], fac[101010];

int power(int x, int k) {
	int t = 1;
	for (; k; x = (long long)x * x % K, k >>= 1)
		if (k & 1)
			t = (long long)t * x % K;
	return t;
}

int inv(int x) {
	return power(x, K-2);
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("input.txt", "w", stdout);
	ios::sync_with_stdio(false);
//	n = rand() % 1000;
//	cout << n << endl;
//	while (n--)
//		cout << rand() << " ";
//	cout << endl, exit(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	if (n % 4 == 3) {
		bool flag = 1;
		for (int i = 1; i < n; ++i, flag ^= 1)
			if (flag)
				a[i-1] = (a[i-1] + a[i]) % K;
			else
				a[i-1] = (a[i-1] - a[i] + K) % K;
		-- n;
	}
	int m = (n - 1) / 2, ans = 0;
	fac[0] = 1;
	for (int i = 1; i <= m; ++i)
		fac[i] = (long long)fac[i-1] * i % K;
	if (n % 4 == 1)
		for (int i = 0; i < n; i += 2)
			ans = (ans + (long long)a[i] * fac[m] % K * inv(fac[i/2]) % K * inv(fac[m-i/2])) % K;
	else if (n % 4 == 2)
		for (int i = 0; i < n; i += 2)
			ans = (ans + (long long)(a[i] + a[i+1]) * fac[m] % K * inv(fac[i/2]) % K * inv(fac[m-i/2])) % K;
	else {
		for (int i = 0; i <= m; ++i)
			if (i & 1)
				ans = (ans + (long long)(a[n-1-i] - a[i] + K) * fac[m] % K * inv(fac[i]) % K * inv(fac[m-i])) % K;
			else
				ans = (ans + (long long)(a[i] - a[n-1-i] + K) * fac[m] % K * inv(fac[i]) % K * inv(fac[m-i])) % K;
	}
	cout << ans << endl;
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cassert>

using namespace std;

const int K = 1e9 + 7;
int n, a[201010], fac[101010];

int power(int x, int k) {
	int t = 1;
	for (; k; x = (long long)x * x % K, k >>= 1)
		if (k & 1)
			t = (long long)t * x % K;
	return t;
}

int inv(int x) {
	return power(x, K-2);
}

int main() {
//	freopen("input.txt", "r", stdin);
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	if (n % 4 == 3) {
		bool flag = 1;
		for (int i = 1; i < n; ++i, flag ^= 1)
			if (flag)
				a[i-1] = (a[i-1] + a[i]) % K;
			else
				a[i-1] = (a[i-1] - a[i] + K) % K;
		-- n;
	}
	int m = (n - 1) / 2, ans = 0;
	fac[0] = 1;
	for (int i = 1; i <= m; ++i)
		fac[i] = (long long)fac[i-1] * i % K;
	if (n % 4 == 1)
		for (int i = 0; i < n; i += 2)
			ans = (ans + (long long)a[i] * fac[m] % K * inv(fac[i/2]) % K * inv(fac[m-i/2])) % K;
	else if (n % 4 == 2)
		for (int i = 0; i < n; i += 2)
			ans = (ans + (long long)(a[i] + a[i+1]) * fac[m] % K * inv(fac[i/2]) % K * inv(fac[m-i/2])) % K;
	else
		for (int i = 0; i <= m / 2; ++i)
			ans = (ans + ((long long)a[i*2] - a[i*2+1] - a[n-1-i*2] + a[n-1-i*2-1] + K + K) * fac[m] % K * inv(fac[i]) % K * inv(fac[m-i])) % K;
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
#define N 1000005
#define LL long long
using namespace std;
const int mo=1e9+7;
int n,b[N],a[N],fc[N],xf[N],P,Q;
LL fpm(LL x,LL y){ LL s=1; while(y){ if(y&1) s=(s*x)%mo; y>>=1,x=(x*x)%mo;} return s;}
LL C(int n,int m){ return 1LL*fc[n]*xf[n-m]%mo*xf[m]%mo;}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&b[i]);
	if(n==1){ printf("%d",b[1]); return 0;}
	if(n&1){
		for(i=1;i<n;i++)
			if(i&1) a[i]=(b[i]+b[i+1])%mo;
			else a[i]=(b[i]-b[i+1]+mo)%mo;
		n--;
	  }
	else
		for(i=1;i<=n;i++) a[i]=b[i];
	fc[0]=xf[0]=1;
	for(i=1;i<=n;i++){
		fc[i]=(1LL*fc[i-1]*i)%mo;
		xf[i]=fpm(fc[i],mo-2);
	  }
	for(i=0;i<=n/2-1;i++){
		P=(P+C(n/2-1,i)*a[i*2+1])%mo;
		Q=(Q+C(n/2-1,i)*a[i*2+2])%mo;
	  }
	if((n/2)&1) P=(P+Q)%mo;
	else P=(P-Q+mo)%mo;
	cout<<P;
	return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define RG register
#define ll long long
#define For(i, f, t) for (RG int i = f; i <= t; i++)

const int MaxN = 200010, Mod = 1e9 + 7;

int n;
int fac[MaxN], inv[MaxN];

int Pow(int x, int y)
{
	int tmp = 1;
	for (; y; y >>= 1)
	{
		if (y & 1) tmp = (ll) tmp * x % Mod;
		x = (ll) x * x % Mod;
	}
	return tmp;
}

int c(int n, int m)
{
	if (n < 0 || m < 0 || n < m) return 0;
	return (ll) fac[n] * inv[m] % Mod * inv[n - m] % Mod;
}

int main()
{
	scanf("%d", &n);
	fac[0] = 1; For (i, 1, n) fac[i] = (ll) fac[i - 1] * i % Mod;
	inv[n] = Pow(fac[n], Mod - 2);
	for (int i = n; i; i--) inv[i - 1] = (ll) inv[i] * i % Mod;
	int Ans = 0;
	For (i, 1, n)
	{
		int x; scanf("%d", &x);
		if (n % 4 == 0)
		{
			x = (ll) x * c(n / 2 - 1, (i - 1) / 2) * (i & 1 ? 1 : -1) % Mod;
		}
		if (n % 4 == 1)
		{
			if (i & 1) x = (ll) x * c(n / 2, i / 2) % Mod;
			else x = 0;
		}
		if (n % 4 == 2)
		{
			x = (ll) x * c(n / 2 - 1, (i - 1) / 2) % Mod;
		}
		if (n % 4 == 3)
		{
			if (i & 1) x = (ll) x * (c(n / 2 - 1, i / 2) - (i > 1 ? c(n / 2 - 1, i / 2 - 1) : 0)) % Mod;
			else x = (ll) x * 2 * c(n / 2 - 1, i / 2 - 1) % Mod;
		}
		Ans = (Ans + x) % Mod;
	}
	printf("%d\n", (Ans + Mod) % Mod);
	return 0;
}


#include <cstdio>
typedef long long LL;
const int maxn = 200001, mod = 1000000007;
int iact[maxn], fact[maxn];
int n, a[maxn], ans;
inline int C(int n, int m) {
	return (LL)fact[n] * iact[m] % mod * iact[n - m] % mod;
}
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
		scanf("%d", a + i);
	iact[1] = 1;
	for(int i = 2; i <= n; ++i)
		iact[i] = mod - (int)(mod / i * (LL)iact[mod % i] % mod);
	fact[0] = iact[0] = 1;
	for(int i = 1; i <= n; ++i) {
		fact[i] = (LL)fact[i - 1] * i % mod;
		iact[i] = (LL)iact[i - 1] * iact[i] % mod;
	}
	if(n & 1) {
		if(n & 2) {
			int m = n >> 1;
			for(int i = 0; i < m; ++i)
				ans = (ans + (LL)C(m - 1, i) * a[i << 1 | 1]) % mod;
			(ans <<= 1) >= mod && (ans -= mod);
			for(int i = 0; i < m; ++i)
				ans = (ans + (LL)C(m - 1, i) * (a[i << 1] - a[(i + 1) << 1])) % mod;
			if(ans < 0)
				ans += mod;
		} else {
			int m = (n + 1) >> 1;
			for(int i = 0; i < m; ++i)
				ans = (ans + (LL)C(m - 1, i) * a[i << 1]) % mod;
		}
	} else {
		int m = n >> 1;
		for(int i = 0; i < m; ++i)
			ans = (ans + (LL)C(m - 1, i) * a[i << 1]) % mod;
		if(m & 1) {
			for(int i = 0; i < m; ++i)
				ans = (ans + (LL)C(m - 1, i) * a[i << 1 | 1]) % mod;
		} else {
			for(int i = 0; i < m; ++i)
				ans = (ans - (LL)C(m - 1, i) * a[i << 1 | 1]) % mod;
			if(ans < 0)
				ans += mod;
		}
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define pr pair<int, int>
#define x first
#define y second
using namespace std;

template<typename T>
void read(T& n){
	char ch; int sign = 1;
	while (!isdigit(ch = getchar())) if (ch == '-') sign = -1;
	n = ch - '0';
	while (isdigit(ch = getchar())) n = n * 10 + ch - '0';
	n *= sign;
}
typedef long long ll;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int N = 211111;
int n, len;
ll a[N], mul[N], f[N], lf[N];

ll mut(ll a, ll b){
	ll y = 1, t = a;
	for (; b; b >>= 1, t = t * t % MOD)
		if (b & 1) y = y * t % MOD;
	return y;
}
ll C(int n, int m){return mul[n] * mut(mul[m], MOD - 2) * mut(mul[n-m], MOD - 2);}

int main(){
	read(n);
	rep(i, 0, n - 1) read(a[i]);
	mul[0] = 1; rep(i, 1, n) mul[i] = mul[i-1] * i % MOD;
	int dep = (n - 1) / 4 * 2; f[0] = 1;
	len = dep * 2; rep(i, 1, dep) f[i*2-1] = 0, f[i*2] = C(dep, i);
	if (n % 4 != 1){
		len = dep * 2 + 1; rep(i, 0, dep * 2) lf[i] = f[i];
		rep(i, 0, len) f[i] = i % 2 ? (i ? lf[i-1] : 0) - lf[i] : (i ? lf[i-1] : 0) + lf[i];
		if (n % 4 != 2){
			len = dep * 2 + 2; rep(i, 0, dep * 2 + 1) lf[i] = f[i];
			rep(i, 0, len) f[i] = i % 2 ? (i ? lf[i-1] : 0) + lf[i] : lf[i] - (i ? lf[i-1] : 0);
			if (n % 4 != 3){
				len = dep * 2 + 3; rep(i, 0, dep * 2 + 2) lf[i] = f[i];
				rep(i, 0, len) f[i] = i % 2 ? (i ? lf[i-1] : 0) - lf[i] : (i ? lf[i-1] : 0) + lf[i];
			}
		}
	}
	assert(len == n - 1); ll ans = 0;
	rep(i, 0, n - 1) ans = (ans + a[i] * f[i]) % MOD;
	printf("%I64d\n", (ans + MOD) % MOD);
	return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define pr pair<int, int>
#define x first
#define y second
using namespace std;

template<typename T>
void read(T& n){
	char ch; int sign = 1;
	while (!isdigit(ch = getchar())) if (ch == '-') sign = -1;
	n = ch - '0';
	while (isdigit(ch = getchar())) n = n * 10 + ch - '0';
	n *= sign;
}
typedef long long ll;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int N = 211111;
int n, len;
ll a[N], mul[N], f[N], lf[N];

ll mut(ll a, ll b){
	ll y = 1, t = a;
	for (; b; b >>= 1, t = t * t % MOD)
		if (b & 1) y = y * t % MOD;
	return y;
}
ll C(int n, int m){return mul[n] * mut(mul[m], MOD - 2) % MOD * mut(mul[n-m], MOD - 2) % MOD;}

int main(){
	read(n);
	rep(i, 0, n - 1) read(a[i]);
	mul[0] = 1; rep(i, 1, n) mul[i] = mul[i-1] * i % MOD;
	int dep = (n - 1) / 4 * 2; f[0] = 1;
	len = dep * 2; rep(i, 1, dep) f[i*2-1] = 0, f[i*2] = C(dep, i);
	if (n % 4 != 1){
		len = dep * 2 + 1; rep(i, 0, dep * 2) lf[i] = f[i];
		rep(i, 0, len) f[i] = i % 2 ? (i ? lf[i-1] : 0) - lf[i] : (i ? lf[i-1] : 0) + lf[i];
		if (n % 4 != 2){
			len = dep * 2 + 2; rep(i, 0, dep * 2 + 1) lf[i] = f[i];
			rep(i, 0, len) f[i] = i % 2 ? (i ? lf[i-1] : 0) + lf[i] : lf[i] - (i ? lf[i-1] : 0);
			if (n % 4 != 3){
				len = dep * 2 + 3; rep(i, 0, dep * 2 + 2) lf[i] = f[i];
				rep(i, 0, len) f[i] = i % 2 ? (i ? lf[i-1] : 0) - lf[i] : (i ? lf[i-1] : 0) + lf[i];
			}
		}
	}
	assert(len == n - 1); ll ans = 0;
	rep(i, 0, n - 1) ans = (ans + a[i] * f[i]) % MOD;
	printf("%I64d\n", (ans + MOD) % MOD);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define PII pair<int, int >
#define PLL pair<long long, long long >

const int pp = (1e9) + 7;

int N, sgn, ans1, ans2, ans;
int A[200010], H[200010], Hrev[200010];

LL C(int N, int M){
	LL res = H[N];
	res = res * Hrev[N - M] % pp;
	res = res * Hrev[M] % pp;
	return res;
}

LL quick(int x, int y){
	LL s = 1, t = x;
	for (; y; y >>= 1){
		if (y & 1) s = s * t % pp;
		t = t * t % pp;
	}
	return s;
}

int work(int head){
	int M = N / 2 - 1;
	int res = 0;
	for (int i = 0; i <= M; i++){
		res += (LL)C(M, i) * A[head + 2 * i] % pp;
		res %= pp;
	}
	return res;
}

int main(){
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%d", &A[i]);
	if (N == 1){
		printf("%d\n", A[1]);
		return 0;
	}
	H[0] = 1;
	for (int i = 1; i <= N; i++)
		H[i] = (LL)H[i - 1] * i % pp;
	Hrev[N] = quick(H[N], pp - 2);
	for (int i = N - 1; i >= 0; i--)
		Hrev[i] = (LL)Hrev[i + 1] * (i + 1) % pp;
	if (N & 1){
		sgn = 1;
		for (int i = 1; i < N; i++){
			A[i] = (A[i] + sgn * A[i + 1]) % pp;
			if (A[i] < 0) A[i] += pp;
			sgn = -sgn;
		}
		N--;
	}
	ans1 = work(1);
	ans2 = work(2);
	N /= 2;
	if (N & 1) sgn = 1;
	else sgn = -1;
	ans = (ans1 + sgn * ans2) % pp;
	if (ans < 0) ans += pp;
	cout << ans << endl;
}