#include <bits/stdc++.h>

using namespace std;

#define ull unsigned long long
#define ll long long
#define ui unsigned int
#define us unsigned short
#define inf_int 1e9
#define inf_ll 1e18
#define mod 1000000007
#define smod 998244353

const int maxN = 1e5 + 5;

ll table[maxN][2]; // + -
ll cnt[maxN][2];

ll mulmod(ll a, ll b){
	ll ans = 0;
	
	while(b > 0){
		if(b&1) ans = (ans + a) % mod;
		
		b >>= 1;
		a = (a+a)%mod;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

	int n;
	cin >> n;
	
	ll data[n];
	for(int x=0;x<n;x++){
		cin >> data[x];
	}
	
	fill(cnt[0], cnt[n], 0);
		
	table[0][0] = data[0];
	table[0][1] = 0;
	cnt[0][0] = 1;
	
	for(int x=1;x<n;x++){
		table[x][0] = (table[x-1][0] + table[x-1][1] + mulmod(cnt[x-1][0]+cnt[x-1][1], data[x])) % mod;
		table[x][1] = (table[x-1][0] - mulmod(cnt[x-1][0], data[x])) % mod;
		cnt[x][0] = (cnt[x-1][0] + cnt[x-1][1]) % mod;
		cnt[x][1] = cnt[x-1][0] % mod;
	}
	
	cout << (table[n-1][0] + table[n-1][1] + 2*mod) % mod << "\n";
    return 0;
}
#include <cstdio>
#include <algorithm>
#define int long long
const int M = 200005, p = 998244353;
int n, m, f[20][M], fac[M], inv[M], ans;
int Pow(int a, int b) {
	int an = 1;
	while(b) {
		if(b & 1) an = an * a % p;
		a = a * a % p;
		b >>= 1;
	}
	return an;
}
int C(int n, int m) {
	if(n < m) return 0;
	return fac[n] * inv[m] % p * inv[n-m] % p;
}
void init(int n) {
	fac[0] = 1;
	for(int i = 1; i <= n; i++) fac[i] = fac[i-1] * i % p;
	inv[n] = Pow(fac[n], p-2);
	for(int i = n; i >= 1; i--) inv[i-1] = inv[i] * i % p;
}
signed main() {
	scanf("%lld%lld", &n, &m);
	init(n);
	for(int i = 1; i <= m; i++) f[1][i] = 1;
	for(int i = 1; i <= 18; i++) 
		for(int j = 1; j <= m; j++)
			for(int k = 2*j; k <= m; k += j)
				f[i+1][k] = (f[i+1][k] + f[i][j]) % p;
	for(int i = 1; i <= std::min(18ll, n); i++)	
		for(int j = 1; j <= m; j++)
			ans = (ans + f[i][j] * C(n-1, i-1)) % p;
	printf("%lld", ans);
	return 0;
}