#include <bits/stdc++.h>
using namespace std;
struct Three {
  int x, y, id;
  bool operator<(const Three &that) const { return x > that.x; }
};
int n, p, s, f[3333][3333], g[3333][3333], sum[3333], fdo[3333][3333],
    gdo[3333][3333];
bool umax(int &a, int b) {
  if (b > a) {
    a = b;
    return 1;
  }
  return 0;
}
Three a[3333];
vector<int> ans1, ans2;
void gao1(int i, int j) {
  if (i == 0) return;
  if (fdo[i][j] == 1) {
    ans1.push_back(a[i].id);
    gao1(i - 1, j);
  } else {
    ans2.push_back(a[i].id);
    gao1(i - 1, j - 1);
  }
}
void gao2(int i, int j) {
  if (j == 0) return;
  if (gdo[i][j]) {
    ans2.push_back(a[i].id);
    gao2(i + 1, j - 1);
  } else
    gao2(i + 1, j);
}
void out() {
  for (int i = 0; i < p; i++) printf("%d%c", ans1[i], " \n"[i == p - 1]);
  for (int i = 0; i < s; i++) printf("%d%c", ans2[i], " \n"[i == s - 1]);
}
void getAns(int ans) {
  for (int i = p; i - p <= s; i++) {
    if (f[i][i - p] + g[i + 1][s - (i - p)] == ans) {
      gao1(i, i - p);
      gao2(i + 1, s - (i - p));
      out();
      return;
    }
  }
  for (int i = s; i <= s + p; i++) {
    if (f[i][s] + sum[p + s] - sum[i] == ans) {
      gao1(i, s);
      for (int j = i + 1; j <= p + s; j++) ans1.push_back(a[j].id);
      out();
      return;
    }
  }
}
int main() {
  cin >> n >> p >> s;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].x);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].y), a[i].id = i;
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i].x;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (i > j) f[i][j] = f[i - 1][j] + a[i].x, fdo[i][j] = 1;
      if (j)
        if (umax(f[i][j], f[i - 1][j - 1] + a[i].y)) fdo[i][j] = 2;
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j <= (n - i + 1); j++) {
      if (n - i + 1 > j) g[i][j] = g[i + 1][j];
      if (j)
        if (umax(g[i][j], g[i + 1][j - 1] + a[i].y)) gdo[i][j] = 2;
    }
  }
  int ans = 0;
  for (int i = p; i - p <= s; i++) {
    umax(ans, f[i][i - p] + g[i + 1][s - (i - p)]);
  }
  for (int i = s; i <= s + p; i++) {
    umax(ans, f[i][s] + sum[p + s] - sum[i]);
  }
  cout << ans << endl;
  getAns(ans);
  return 0;
}
