#include <bits/stdc++.h>
using namespace std;
struct el {
  int a;
  int b;
  int ind;
};
bool operator<(el a, el b) { return a.b - a.a < b.b - b.a; }
int n, A, B;
el arr[3333];
int dp[3333][3333];
int fr[3333][3333];
int sl[3333], cnt = 0;
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> A >> B;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i].a;
  }
  for (int j = 1; j <= n; j++) {
    cin >> arr[j].b;
    arr[j].ind = j;
  }
  sort(arr + 1, arr + 1 + n);
  for (int i = 0; i <= A + B; i++) {
    dp[0][i] = -1 << 30;
  }
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= A + B; j++) {
      dp[i][j] = dp[i - 1][j];
      fr[i][j] = j;
      if (j > 0) {
        if (j > A) {
          if (dp[i][j] < dp[i - 1][j - 1] + arr[i].b) {
            dp[i][j] = dp[i - 1][j - 1] + arr[i].b;
            fr[i][j] = j - 1;
          }
        } else {
          if (dp[i][j] < dp[i - 1][j - 1] + arr[i].a) {
            dp[i][j] = dp[i - 1][j - 1] + arr[i].a;
            fr[i][j] = j - 1;
          }
        }
      }
    }
  }
  cout << dp[n][A + B] << endl;
  ;
  int curr = A + B;
  for (int i = n; i >= 1; i--) {
    if (fr[i][curr] != curr) {
      sl[cnt++] = arr[i].ind;
      curr--;
    }
  }
  reverse(sl, sl + cnt);
  for (int i = 0; i < A; i++) {
    cout << sl[i] << " ";
  }
  cout << endl;
  for (int i = A; i < A + B; i++) {
    cout << sl[i] << " ";
  }
}
