func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long maxx = 1e6 + 7;   const long long maxn = 1e6 + 7;   const long long mod = 998244353;   const long long maxs = 500000 + 7;   const long long maxm = 400000 + 7;   const long long maxk = 1008 + 7;   const long long maxw = 100 + 7;   const long long maxh = 100 + 7;   const double pi = 3.1415926;   const long long ten = 10;   const long long ooi = 1000000;   const long long ool = 1e18 + 7;   const long double eps = 1e-8;   const int apsz = 26;   long long n;   void init() { cin >> n; }   void solve() {     vector<long long> a(n, 0);     vector<long long> b(n, 0);     vector<long long> pos(n);     for (long long i = (0); i < (n); i++) cin >> a[i];     for (long long i = (0); i < (n); i++) cin >> b[i];     sort(b.begin(), b.end());     for (long long i = (0); i < (n); i++) {       long long ans = 0;       long long lt = i;       long long rt = n - i - 1;       ans = (lt + 1) * (rt + 1);       ans *= a[i];       pos[i] = ans;     }     sort(pos.begin(), pos.end(), greater<long long>());     long long ans = 0;     long long p1 = 0;     while (p1 < n) {       pos[p1] %= mod;       ans += (b[p1] * pos[p1]) % mod;       ans %= mod;       p1++;     }     cout << ans << endl;   }   int main(void) {     ios::sync_with_stdio(false);     cout.tie(0);     cin.tie(0);     init();     solve();     return 0;   }   