#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

typedef pair<ll, ll> P;

const ll N_MAX = 1000000;
const ll MOD = 998244353;
bool isPrime[N_MAX+1];
vector<ll> fac[N_MAX+1];
vector<ll> divs[N_MAX+1];
vector<ll> p;
ll inv[N_MAX+1];
P w[N_MAX+1];

ll inv_(ll n){
    if(n == 1) return 1;
    else return MOD-inv_(MOD%n)*(MOD/n)%MOD;
}

void init(){
    inv[1]=1;
    for(ll i=2;i<N_MAX;i++){
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    for(ll i = 2; i <= N_MAX; i++){
        isPrime[i] = true;
    }
    for(ll i = 2; i <= N_MAX; i++){
        if(isPrime[i]){
            p.push_back(i);
            for(ll j = 2; i*j <= N_MAX; j++){
                isPrime[i*j] = false;
            }
        }
    }
    fac[1].push_back(1);
    for(ll i = 2; i <= N_MAX; i++){
        //cout << i << endl;
        if(isPrime[i]){
            fac[i].push_back(i);
        }else{
            //cout << "HI" << endl;
            for(ll j = 0; p[j]*p[j] <= N_MAX; j++){
                //cout << p[j] << ' ' << endl;
                if(i%p[j] == 0){
                    ll m = i/p[j];
                    for(ll k = 0; k < fac[m].size(); k++){
                        fac[i].push_back(fac[m][k]);
                    }
                    fac[i].push_back(p[j]);
                    sort(fac[i].begin(), fac[i].end());
                    break;
                }
            }
        }
    }
    divs[1].push_back(1);
    for(ll i = 2; i <= N_MAX; i++){
        //cout << i << endl;
        if(isPrime[i]){
            divs[i].push_back(1);
            divs[i].push_back(i);
        }else{
            ll prev = fac[i][0];
            divs[i].push_back(1);
            vector<ll> tmp;
            tmp.push_back(prev);
            ll cur = prev;
            for(ll j = 1; j < fac[i].size(); j++){
                //cout << fac[i][j] << endl;
                if(prev == fac[i][j]) {
                    cur *= fac[i][j];
                    tmp.push_back(cur);
                }
                if(prev != fac[i][j]){
                    ll s = divs[i].size();
                    for(ll k = 0; k < tmp.size(); k++){
                        for(ll l = 0; l < s; l++){
                            divs[i].push_back(tmp[k]*divs[i][l]);
                        }
                    }
                    prev = fac[i][j];
                    cur = prev;
                    tmp.clear();
                    tmp.push_back(prev);
                }
                if(j+1 == fac[i].size()){
                    ll s = divs[i].size();
                    for(ll k = 0; k < tmp.size(); k++){
                        for(ll l = 0; l < s; l++){
                            divs[i].push_back(tmp[k]*divs[i][l]);
                        }
                    }
                }
            }
        }
    }
}

P add(P a, P b){
    P ans;
    ans.first = (a.first*b.second+a.second*b.first)%MOD;
    ans.second = (a.second*b.second)%MOD;
    return ans;
}

P sub(P a, P b){
    P ans;
    ans.first = ((a.first*b.second-a.second*b.first)%MOD+MOD)%MOD;
    ans.second = (a.second*b.second)%MOD;
    return ans;
}

P mul(P a, P b){
    P ans;
    ans.first = (a.first*b.first)%MOD;
    ans.second = (a.second*b.second)%MOD;
    return ans;
}

void init_calc(){
    w[1] = P(1, 1);
    for(ll i = 2; i <= N_MAX; i++){
        //cout << i << endl;
        w[i] = P(1, i);
        for(ll j = 0; j+1 < divs[i].size(); j++){
            w[i] = sub(w[i], w[divs[i][j]]);
        }
    }
}

vector<ll> v[N_MAX+1];

int main(){
    init();
    init_calc();
    int N;
    cin >> N;
    ll s = 0;
    for(int i = 0; i < N; i++){
        ll A;
        cin >> A;
        s += A;
        s %= MOD;
        for(int j = 0; j < divs[A].size(); j++){
            v[divs[A][j]].push_back(A);
        }
    }
   // cout << 'H' << endl;
    P ans = P(0, 1);
    for(int i = 1; i <= N_MAX; i++){
        if(v[i].size() != 0){
            ll sum = 0;
            for(int j = 0; j < v[i].size(); j++){
                sum += v[i][j];
                sum %= MOD;
            }
            //cout << i << ' ' << sum << endl;
            P tmp = mul(P((sum*sum)%MOD, 1), w[i]);
            ans = add(ans, tmp);
        }
    }
    //cout << 'H' << endl;
    ans = sub(ans, P(s, 1));
    ll a = ans.first;
    ll b = ans.second;
    ll x = (a*inv_(b))%MOD;
    x = x*inv[2];
    x %= MOD;
    cout << x << endl;
}

Measured memory_bytes: 380168