Dima and Inna love spending time together. The problem is, Seryozha isn't too enthusiastic to leave his room for some reason. But Dima and Inna love each other so much that they decided to get criminal...

Dima constructed a trap graph. He shouted: "Hey Seryozha, have a look at my cool graph!" to get his roommate interested and kicked him into the first node.

A trap graph is an undirected graph consisting of n nodes and m edges. For edge number k, Dima denoted a range of integers from lk to rk (lk ≤ rk). In order to get out of the trap graph, Seryozha initially (before starting his movements) should pick some integer (let's call it x), then Seryozha must go some way from the starting node with number 1 to the final node with number n. At that, Seryozha can go along edge k only if lk ≤ x ≤ rk.

Seryozha is a mathematician. He defined the loyalty of some path from the 1-st node to the n-th one as the number of integers x, such that if he initially chooses one of them, he passes the whole path. Help Seryozha find the path of maximum loyalty and return to his room as quickly as possible!

Input

The first line of the input contains two integers n and m (2 ≤ n ≤ 103, 0 ≤ m ≤ 3·103). Then follow m lines describing the edges. Each line contains four integers ak, bk, lk and rk (1 ≤ ak, bk ≤ n, 1 ≤ lk ≤ rk ≤ 106). The numbers mean that in the trap graph the k-th edge connects nodes ak and bk, this edge corresponds to the range of integers from lk to rk.

Note that the given graph can have loops and multiple edges.

Output

In a single line of the output print an integer — the maximum loyalty among all paths from the first node to the n-th one. If such paths do not exist or the maximum loyalty equals 0, print in a single line "Nice work, Dima!" without the quotes.

Examples

Input

4 4
1 2 1 10
2 4 3 5
1 3 1 5
2 4 2 7


Output

6


Input

5 6
1 2 1 10
2 5 11 20
1 4 2 5
1 3 10 11
3 4 12 10000
4 5 6 6


Output

Nice work, Dima!

Note

Explanation of the first example.

Overall, we have 2 ways to get from node 1 to node 4: first you must go along the edge 1-2 with range [1-10], then along one of the two edges 2-4. 

One of them contains range [3-5], that is, we can pass through with numbers 3, 4, 5. So the loyalty of such path is 3.

If we go along edge 2-4 with range [2-7], then we can pass through with numbers 2, 3, 4, 5, 6, 7. The loyalty is 6. That is the answer.

The edge 1-2 have no influence on the answer because its range includes both ranges of the following edges.
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import static java.util.Collections.*;

import java.awt.Point;
import java.io.*;

public class _366_D_Dima_and_Trap_Graph {
	//->solution screencast http://youtu.be/oHg5SJYRHA0
	public void solve() {
		int n = ni(), m=ni();
		HashMap<Integer,Node> map = new HashMap<Integer, Node>();
		for (int i = 0; i < n; i++) {
			map.put(i+1, new Node(i+1,new Point(0,1000000)));
		}
//		pr(map);
		HashMap<String,Point> cons2 = new HashMap<String, Point>();
		for (int i = 0; i < m; i++) {
			Node a = map.get(ni());
			Node b = map.get(ni());
			
			Nodex bx = new Nodex();
			bx.n=b;
			bx.x=new Point(ni(),ni());
			a.nodes.add(bx); 
//			if(cons2.containsKey(key))
//			cons2.put(a.idx+" "+b.idx+" "+i,);
		}
		pr(cons2);
//		pr("Q");
		LinkedList<Node> Q = new LinkedList<Node>();
		HashSet<Nodex> memo=new HashSet<Nodex>();
		
		Q.add(map.get(1));
		int max=0;
		while(!Q.isEmpty()){
//			pr(Q);
			Node p = Q.poll();
			if(p.idx==n){
//				pr(p.ab);
				max=max(p.ab.y-p.ab.x+1,max);
			}
			for (Nodex state : map.get(p.idx).nodes) {
				if(!memo.contains(state)){
					memo.add(state);
					Point atob = state.x;
					Point nw = get(p.ab,atob);
//					pr(nw);
					if(nw!=null)
						Q.add(new Node(state.n.idx,nw));
				}
			}
		}
		if(max==0){
			out.println("Nice work, Dima!");
		}else
			out.println(max);
	}
	Point get(Point a, Point b){
		if(a.x<=b.x && b.x<=a.y){
			if(a.x<=b.y && b.y<=a.y){
				return b;
			}else{
				return new Point(b.x,a.y);
			}
		}else if(a.x<=b.y && b.y<=a.y){
			if(a.x<=b.x && b.x<=a.y){
				return b;
			}else{
				return new Point(a.x,b.y);
			}
		}
		return null;
	}
	
	class Nodex{
		Node n;
		Point x;
		
	}
	class Node{
		ArrayList<Nodex> nodes = new ArrayList<Nodex>();
		int idx;
		int i;
//		int a,b;
		Point ab;
		public Node(int idx, Point ab) {
			this.idx=idx;
			this.ab=ab;
		}
		@Override
		public String toString() {
			// TODO Auto-generated method stub
			return idx+" "+ab.x+"-"+ab.y;
		}
	}
	
	
	// IO methods
		
	void run() throws Exception {
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		pr(System.currentTimeMillis() - s + "ms");
	}
	public static void main(String[] args) throws Exception {new _366_D_Dima_and_Trap_Graph().run();}

	InputStream in=System.in;
	PrintWriter out=new PrintWriter(System.out);
	
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = in.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {return !(c >= 33 && c <= 126);}
	private int skip() {int b;while ((b = readByte()) != -1 && isSpaceChar(b));return b;}

	public String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != // ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	public char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	public int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	
	
	public int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	public long nl(){
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	void pr(Object... ob) {if (!oj)System.out.println(Arrays.deepToString(ob).replace("],", "],\n"));}
}

