#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1000 + 10;
const int maxm = 30000 + 100;
int save[maxm][3];
struct Edge {
  int v;
  long long w;
  int id;
  Edge(int v = 0, long long w = 0, int id = 0) : v(v), w(w), id(id) {}
};
vector<Edge> G[maxn];
int n, m;
int S, T;
int seq[maxm];
int seqidx;
struct Node {
  int u;
  int prvedge;
  int prv;
  Node(int u = 0, int prvedge = 0, int prv = 0)
      : u(u), prvedge(prvedge), prv(prv) {}
};
Node Queue[maxn];
bool S2Tvis[maxn];
bool S2T() {
  memset(S2Tvis, 0, sizeof(S2Tvis));
  S2Tvis[S] = 1;
  int head = 0;
  int tail = 0;
  Queue[tail++] = Node(S, -1, -1);
  while (head < tail) {
    Node now = Queue[head++];
    int u = now.u;
    if (u == T) {
      int p = head - 1;
      seqidx = 0;
      while (Queue[p].prv != -1) {
        seq[seqidx++] = Queue[p].prvedge;
        p = Queue[p].prv;
      }
      return true;
    }
    for (int i = 0; i < G[u].size(); ++i) {
      int v = G[u][i].v;
      if (!S2Tvis[v]) {
        S2Tvis[v] = 1;
        Node nxt = Node(v, G[u][i].id, head - 1);
        Queue[tail++] = nxt;
      }
    }
  }
  return false;
}
bool edgedel[maxm];
int pre[maxn], iscut[maxn], isbridge[maxm];
int ebccno[maxn], dfs_clock, ebcc_cnt;
int dfs(int u, int fa) {
  int lowu = pre[u] = ++dfs_clock;
  int child = 0;
  for (int i = 0; i < G[u].size(); ++i) {
    if (edgedel[G[u][i].id]) continue;
    int v = G[u][i].v;
    if (!pre[v]) {
      child++;
      int lowv = dfs(v, u);
      lowu = min(lowu, lowv);
      if (lowv >= pre[u]) iscut[u] = true;
      if (lowv > pre[u]) {
        isbridge[G[u][i].id] = true;
      }
    } else if (pre[v] < pre[u] && v != fa)
      lowu = min(lowu, pre[v]);
  }
  if (fa < 0 && child == 1) iscut[u] = 0;
  return lowu;
}
void dfs2(int u, int idx) {
  ebccno[u] = idx;
  for (int i = 0; i < G[u].size(); ++i) {
    if (edgedel[G[u][i].id]) continue;
    int v = G[u][i].v;
    if (!ebccno[v] && !isbridge[G[u][i].id]) dfs2(v, idx);
  }
}
void find_ebcc(int n) {
  memset(pre, 0, sizeof(pre));
  memset(iscut, 0, sizeof(iscut));
  memset(isbridge, 0, sizeof(isbridge));
  memset(ebccno, 0, sizeof(ebccno));
  dfs_clock = ebcc_cnt = 0;
  for (int i = 1; i <= n; ++i)
    if (!pre[i]) dfs(i, -1);
  for (int i = 1; i <= n; ++i)
    if (!ebccno[i]) {
      ebcc_cnt++;
      dfs2(i, ebcc_cnt);
    }
}
vector<Edge> M[maxn];
Node MQueue[maxm];
bool Mvis[maxn];
int Mid;
long long solve() {
  Mid = -1;
  memset(Mvis, 0, sizeof(Mvis));
  for (int i = 0; i <= ebcc_cnt; ++i) M[i].clear();
  for (int i = 1; i <= m; ++i) {
    if (edgedel[i]) continue;
    int a = ebccno[save[i][0]];
    int b = ebccno[save[i][1]];
    int w = save[i][2];
    if (a != b) {
      M[a].push_back(Edge(b, w, i));
      M[b].push_back(Edge(a, w, i));
    }
  }
  int s = ebccno[S];
  int t = ebccno[T];
  Mvis[s] = 1;
  int head = 0, tail = 0;
  MQueue[tail++] = Node(s, -1, -1);
  while (head < tail) {
    Node now = MQueue[head++];
    int u = now.u;
    if (u == t) {
      long long Min = INF;
      int p = head - 1;
      while (MQueue[p].prv != -1) {
        int id = MQueue[p].prvedge;
        if (save[id][2] < Min) {
          Min = save[id][2];
          Mid = id;
        }
        p = MQueue[p].prv;
      }
      return Min;
    }
    for (int i = 0; i < M[u].size(); ++i) {
      int v = M[u][i].v;
      if (!Mvis[v]) {
        Mvis[v] = 1;
        Node nxt = Node(v, M[u][i].id, head - 1);
        MQueue[tail++] = nxt;
      }
    }
  }
  return 0;
}
int main() {
  scanf("%d %d", &n, &m);
  scanf("%d %d", &S, &T);
  for (int i = 1; i <= m; ++i) {
    int a, b;
    long long w;
    scanf("%d %d %lld", &a, &b, &w);
    G[a].push_back(Edge(b, w, i));
    G[b].push_back(Edge(a, w, i));
    save[i][0] = a;
    save[i][1] = b;
    save[i][2] = (int)w;
  }
  if (!S2T()) {
    printf("0\n0\n");
  } else {
    find_ebcc(n);
    long long res = INF;
    int a = -1, b = -1;
    memset(edgedel, 0, sizeof(edgedel));
    for (int i = 0; i < seqidx; ++i) {
      edgedel[seq[i]] = 1;
      find_ebcc(n);
      if (ebccno[S] == ebccno[T])
        continue;
      else {
        long long t = solve() + save[seq[i]][2];
        if (res > t) {
          res = t;
          a = seq[i];
          b = Mid;
        }
      }
      edgedel[seq[i]] = 0;
    }
    if (res == INF)
      puts("-1");
    else {
      printf("%lld\n", res);
      if (b == -1)
        printf("1\n%d\n", a);
      else
        printf("2\n%d %d\n", a, b);
    }
  }
  return 0;
}
