Problem: Vasya participates in a ski race along the X axis. The start is at point 0, and the finish is at L, that is, at a distance L meters from the start in the positive direction of the axis. Vasya has been training so hard that he can run one meter in exactly one second.

Besides, there are n take-off ramps on the track, each ramp is characterized by four numbers: 

  * xi represents the ramp's coordinate 
  * di represents from how many meters Vasya will land if he goes down this ramp 
  * ti represents the flight time in seconds 
  * pi is the number, indicating for how many meters Vasya should gather speed to get ready and fly off the ramp. As Vasya gathers speed, he should ski on the snow (that is, he should not be flying), but his speed still equals one meter per second. 



Vasya is allowed to move in any direction on the X axis, but he is prohibited to cross the start line, that is go to the negative semiaxis. Vasya himself chooses which take-off ramps he will use and in what order, that is, he is not obliged to take off from all the ramps he encounters. Specifically, Vasya can skip the ramp. It is guaranteed that xi + di ≤ L, that is, Vasya cannot cross the finish line in flight.

Vasya can jump from the ramp only in the positive direction of X axis. More formally, when using the i-th ramp, Vasya starts gathering speed at point xi - pi, jumps at point xi, and lands at point xi + di. He cannot use the ramp in opposite direction.

Your task is to find the minimum time that Vasya will spend to cover the distance.

Input

The first line contains two integers n and L (0 ≤ n ≤ 105, 1 ≤ L ≤ 109). Then n lines contain the descriptions of the ramps, each description is on a single line. Each description is a group of four non-negative integers xi, di, ti, pi (0 ≤ xi ≤ L, 1 ≤ di, ti, pi ≤ 109, xi + di ≤ L).

Output

Print in the first line the minimum time in seconds Vasya needs to complete the track. Print in the second line k — the number of take-off ramps that Vasya needs to use, and print on the third line of output k numbers the number the take-off ramps Vasya used in the order in which he used them. Print each number exactly once, separate the numbers with a space. The ramps are numbered starting from 1 in the order in which they are given in the input.

Examples

Input

2 20
5 10 5 5
4 16 1 7


Output

15
1
1 

Input

2 20
9 8 12 6
15 5 1 1


Output

16
1
2 

Note

In the first sample, Vasya cannot use ramp 2, because then he will need to gather speed starting from point -3, which is not permitted by the statement. The optimal option is using ramp 1, the resulting time is: moving to the point of gathering speed + gathering speed until reaching the takeoff ramp + flight time + moving to the finish line = 0 + 5 + 5 + 5 = 15.

In the second sample using ramp 1 is not optimal for Vasya as t1 > d1. The optimal option is using ramp 2, the resulting time is: moving to the point of gathering speed + gathering speed until reaching the takeoff ramp + flight time + moving to the finish line = 14 + 1 + 1 + 0 = 16.

Solution (in JAVA):

Solution:
import java.util.*;
import java.util.Collections.*;

public class D {

  static int N;
  static int L;
  static long nodes[];
  static int jump_start[];
  static int jump_end[];
  static int jump_time[];

  static int pos_of(long val) {
    return (int) (val / (N+1));
  }
  static int jump_id(long val) {
    return (int) (val % (N+1));
  }
  static long pack(int pos, int jump_id) {
    return (long)pos * (N+1) + jump_id;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    N = sc.nextInt();
    L = sc.nextInt();

    jump_start = new int[N];
    jump_end = new int[N];
    jump_time = new int[N];

    int node_count = 0;

    for (int i = 0; i < N; ++i) {
      int x = sc.nextInt();
      int d = sc.nextInt();
      int t = sc.nextInt();
      int p = sc.nextInt();

      if (x-p >= 0) {
        node_count += 1;
      }
      jump_start[i] = x-p;
      jump_end[i] = x+d;
      jump_time[i] = t+p;
    }

    nodes = new long[node_count+1];
    int idx = 0;
    for (int i = 0; i < N; ++i) {
      if (jump_start[i] >= 0) {
        nodes[idx++] = pack(jump_start[i], i);
      }
    }
    nodes[idx] = pack(L, N);
    Arrays.sort(nodes);

    int min_dist[] = new int[node_count+1];
    int back_edges[] = new int[node_count+1];
    int reached = SparseDjikstra(0, pos_of(nodes[0]), min_dist, back_edges);

    List<Integer> jumps = new ArrayList<Integer>();
    int cur = node_count;
    while (cur > 0) {
      int prev = back_edges[cur];
      if (jumped(prev, cur)) {
        jumps.add(jump_id(nodes[prev]));
      }
      cur = prev;
    }

    System.out.printf("%d\n%d\n", min_dist[node_count], jumps.size());
    for (int i = jumps.size()-1; i >=0; --i) {
      System.out.printf("%d ", jumps.get(i)+1);
    }
    System.out.printf("\n");
  }

  public static int dist(int i, int j) { // REQUIRED for Sparse and Dense: to be implemented per problem
    if (i < 0 || j < 0) {
      return -1;
    }
    int posi = pos_of(nodes[i]);
    int posj = pos_of(nodes[j]);
    int jump = jump_id(nodes[i]);

    if (posj < posi) {
      return posi - posj;
    }
    int runtime = posj - posi;
    int jumppos = jump_end[jump];
    int jumptime = jump_time[jump] + (posj > jumppos ? posj - jumppos: jumppos - posj);
    return jumptime <= runtime ? jumptime : runtime;
  }

  public static int[] neighbours(int i) { // REQUIRED for Sparse
    if (i == nodes.length -1) {
      return new int[0]; // last node has no neighbours
    }
    int out[] = new int[4];
    Arrays.fill(out, -1);

    out[0] = i-1; // run back
    out[1] = i+1; // run forward

    int jump = jump_id(nodes[i]);
    int landing = jump_end[jump];

    int nexti = Arrays.binarySearch(nodes, pack(landing,0));
    if (nexti < 0) {
      nexti = -(nexti+1);
    }
    out[2] = nexti; // jump and run forward
    out[3] = nexti -1; // jump and run back

    return out; // returns array of neighbours of i
  }

  public static boolean jumped(int i, int j) {
    if (i < 0 || j < 0) {
      return false;
    }
    int posi = pos_of(nodes[i]);
    int posj = pos_of(nodes[j]);
    int jump = jump_id(nodes[i]);

    if (posj < posi) {
      return false;
    }
    int runtime = posj - posi;
    int jumppos = jump_end[jump];
    int jumptime = jump_time[jump] + (posj > jumppos ? posj - jumppos: jumppos - posj);

    return jumptime <= runtime ? true : false;
  }

  public static class PriorityPair implements Comparable<PriorityPair> { // REQUIRED for Sparse
    int priority;
    int item;
    public PriorityPair(int _p, int _i) {
      priority = _p;
      item = _i;
    }
    public int compareTo(PriorityPair o) {
      if (priority < o.priority)
        return -1;
      if (priority > o.priority)
        return 1;
      return 0;
    }
  }

  public static int SparseDjikstra(int start, int start_dist, int[] min_dist, int[] back_edges) {
    int n = min_dist.length;
    int[] cur_dist = new int[n]; // temporary distances
    Arrays.fill(cur_dist, -1); // -1 in cur_dist means not visited yet OR already permanent
    Arrays.fill(min_dist, -1); // -1 in min_dist means not permanent yet
    Arrays.fill(back_edges, -1); // -1 in back_edges means not connected to start (yet)
    PriorityQueue<PriorityPair> pq = new PriorityQueue<PriorityPair>(n);

    int i = start;
    int base = start_dist;

    int k;
    for (k = 0; k < n; ++k) {// at most n interations
      min_dist[i] = base;
      cur_dist[i] = -1;

      for (Integer j: neighbours(i)) {
        int cost = dist(i, j);
        if (cost == -1 || min_dist[j] != -1) { continue; } // no edge or already permanent

        int current_best = cur_dist[j];
        int candidate = base + cost;

        if (current_best == -1 || current_best > candidate) { // found a shorted path to j
          cur_dist[j] = candidate;
          pq.add(new PriorityPair(candidate, j));
          back_edges[j] = i;
        }
      }

      boolean nomore = true;
      while (pq.size() > 0) {
        PriorityPair pair = pq.poll();
        if (min_dist[pair.item] != -1) { continue; } // duplicate entry in pq
        nomore = false;
        i = pair.item;
        base = pair.priority;
        break;
      }
      if (nomore) { ++k; break; }
    }

    return k;
  }

}