ll solve(){int n, m, k; cin >> n >> m >> k;
ll res =0;for(int i =1; i <= n; i ++) cin >> a[i], res += a[i];for(int i =1; i <= m; i ++) cin >> b[i];sort(a +1, a + n +1),sort(b +1, b + m +1);if(k &1) res =max(res, res + b[m]- a[1]);else{if(a[1]< b[m]) res += b[m]- a[1],swap(a[1], b[m]);
res =min(res, res +min(b[1], b[m])-max(a[1], a[n]));}return res;}