// ¯\_(ツ)_/¯
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

#define all(x)                      (x).begin(),(x).end()
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << ": " <<  x << endl;

const ll MAXN = 1e2 + 10;
const ll INF = 8e18;
const ll MOD = 998244353; // 1e9 + 9;

int n, W[MAXN];
ll dp[2][MAXN][MAXN * MAXN], fact[MAXN], s;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	dp[0][0][0] = fact[0] = 1;

	for (int i = 1; i <= n; i++) {
		int ind = i & 1, w;
		dp[ind][0][0] = 1;
		fact[i] = fact[i - 1] * i % MOD;
		cin >> w;
		s += w;

		for (int j = 1; j <= i; j++) {
			for (int k = 0; k <= s; k++) {
				dp[ind][j][k] = dp[1 - ind][j][k];
				if (k >= w) dp[ind][j][k] += dp[1 - ind][j - 1][k - w];
				if (dp[ind][j][k] >= MOD) dp[ind][j][k] -= MOD;
			}
		} 
	}

	if (s & 1) return cout << 0 << endl, 0;
	s /= 2;

	ll ans = 0;
	for (int j = 0; j <= n; j++)
		ans = (ans + (dp[n & 1][j][s] * fact[j] % MOD * fact[n - j] % MOD)) % MOD;
	cout << ans << endl;
	return 0;
}

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

const int MAX = 1e6;

int cnt[MAX+4];
bool isSqr[MAX+4];

using pii = pair<int,int>;

long long coprimes(int l, int r){
    //[l,r]에서 x<y인 서로소 쌍의 수
    //전체에서 k로 동시에 나눠떨어지는걸로 포함배제하면 된다
    long long result = 1LL * (r-l+1) * (r-l) / 2;
    for(int i=2;i<=r;i++)if(!isSqr[i]){
        long long tmp = r/i - (l-1)/i;
        if(cnt[i]&1) result -= tmp*(tmp-1)/2;
        else result += tmp*(tmp-1)/2;
    }
    return result;
}

int main(){
    for(int i=2;i<=MAX;i++)if(cnt[i] == 0){
        for(int j=i;j<=MAX;j+=i) cnt[j]++;
        if(1LL*i*i<=MAX) for(int j=i*i;j<=MAX;j+=i*i) isSqr[j] = 1;
    }
    int L, R;
    scanf("%d%d",&L,&R);
    long long ans = 1LL*(R-L+1)*(R-L)/2;
    ans -= coprimes(L,R);
    for(int i=max(2,L);i<=R;i++) ans -= R/i-1;
    printf("%lld\n", ans*2);
    return 0;
}
