**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
# include <bits/stdc++.h>
using namespace std;
# define int long long

vector<tuple<int,int,int>> g[100005];
int t0, t1, t2;
int n, m;

bool ok(int time, int start, int goal){
	priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> q;
	int dis[n+1];
	memset(dis, 0x3f, sizeof(dis));

	dis[start] = time;
	q.push({time, start});

	// cout << endl;
	while(!q.empty()){
		auto [curT, u] = q.top(); q.pop();
		// cout << " :: " << curT << " " << u << endl;
		if(u == goal && curT <= t0) return true;

		if(t1 <= curT && curT < t2){
			dis[u] = t2;
			q.push({t2, u});
		}

		for(auto [v, tbus, twalk]: g[u]){
			// walk
			if(curT+twalk < dis[v]){
				dis[v] = curT + twalk;
				q.push({dis[v], v});
			}

			// bus
			if(curT < t1 && t1 < curT+tbus) continue; // cannot board the bus due to phone call when arrive
			if(t1 <= curT && curT < t2) continue; // cannot board the bus because still on call
			if(curT+tbus < dis[v]){
				dis[v] = curT + tbus;
				q.push({dis[v], v});
			}
		}
	}
	return false;
}

int solve(){
	cin >> n >> m;
	for(int i=1; i<=n; i++) g[i].clear();
	cin >> t0 >> t1 >> t2;

	while(m--){
		int u, v, tbus, twalk;
		cin >> u >> v >> tbus >> twalk;
		g[u].push_back({v, tbus, twalk});
		g[v].push_back({u, tbus, twalk});
	}

	int lo = 0, hi = t0, ans = -1;
	while(lo <= hi){
		int mid = (lo + hi) / 2;
		if(ok(mid, 1, n)){
			ans = mid;
			lo = mid+1;
		}
		else hi = mid-1;
	}

	cout << ans << endl;
	return 0;
}

signed main(){
	ios_base::sync_with_stdio(false);
	int t; cin >> t;
	for(int tc=1; tc<=t; tc++){
		int ans = solve();
	}
}

/*
*/

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
#include <bits/stdc++.h>
using namespace std;

long long inf = numeric_limits<long long>::max();

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    long long t;
    cin>>t;
    vector<int> ans(t);
    int count = 0;
    while (t--){
        count++;
        long long n,m;
        cin>>n>>m;
        if (count==461){
            cout<<n<<" "<<m<<endl;
        }
        long long t0,t1,t2;
        cin>>t0>>t1>>t2;
        if (count==461){
            cout<<t0<<" "<<t1<<" "<<t2<<endl;
        }
        long long temp = t2;
        t2 = t0-t1;
        t1 = t0-temp;
        vector<vector<vector<long long>>> adj_list(n+1);
        for (long long i=0;i<m;i++){
            long long u,v,l1,l2;
            cin>>u>>v>>l1>>l2;
            if (count==461){
                cout<<u<<" "<<v<<" "<<l1<<" "<<l2<<endl;
            }
            adj_list[u].push_back({v,l1,l2});
            adj_list[v].push_back({u,l1,l2});
        }

        priority_queue<pair<long long,long long>> pq;
        pq.push({0,n});
        vector<long long> dist(adj_list.size(),inf);
        dist[n] = 0;
        while (!pq.empty()){
            long long curr_time = pq.top().first;
            long long curr = pq.top().second;
            pq.pop();
            if (dist[curr]<curr_time){
                continue;
            }
            for (vector<long long> child:adj_list[curr]){
                if ((curr_time + child[1] <= t1 || t2<=curr_time) && (curr_time<= t1 || t2<=curr_time)){
                    if (dist[child[0]] > dist[curr]+child[1]){
                        dist[child[0]] = dist[curr]+child[1];
                        pq.push({dist[child[0]],child[0]});
                    }
                }
                if (curr_time<=t1 && dist[child[0]] > t2+child[1]){
                    dist[child[0]] = t2+child[1];
                    pq.push({dist[child[0]],child[0]});
                }
                if (dist[child[0]] > dist[curr]+child[2]){
                    dist[child[0]] = dist[curr]+child[2];
                    pq.push({dist[child[0]],child[0]});
                }
            }
        }
        ans[count-1] = max(t0-dist[1],-1LL);
    }
    for (int x:ans){
        cout<<x<<"\n";
    }
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
#include<bits/stdc++.h>

#define int long long
using namespace std;
const int N = 1e5 + 5;
struct edge {
    int v;
    int w1;
    int w2;
    int nxt;
} e[N << 1];
int head[N], ind;
int vis[N];

struct node {
    int v;
    int t;

    bool operator<(const node &a) const {
        return t < a.t;
    }
};

void add(int u, int v, int w1, int w2) {
    e[ind].v = v;
    e[ind].w1 = w1;
    e[ind].w2 = w2;
    e[ind].nxt = head[u];
    head[u] = ind++;
}

void solve() {
    int n, m;
    cin >> n >> m;
    ind = 0;
    for (int i = 0; i <= n; i++) head[i] = -1;

    int t, t1, t2;
    cin >> t >> t1 >> t2;

    for (int i = 1; i <= m; i++) {
        int u, v, w1, w2;
        cin >> u >> v >> w1 >> w2;
        add(u, v, w1, w2);
        add(v, u, w1, w2);
    }

    vector<node> ans;
    vector<node> ans1;//纯等
    int res = -1;
    priority_queue<node> q;//先坐车
    q.push({n, t});

    for (int i = 0; i <= n; i++) vis[i] = 0;
    while (!q.empty()) {
        auto [u, tt] = q.top();
        q.pop();
        if (u == 1) {
            res = max(res, tt);
            continue;
        }
        if (vis[u] == 1) continue;
        vis[u] = 1;

        for (int i = head[u]; ~i; i = e[i].nxt) {
            int v = e[i].v;
            int w = e[i].w1;
            if (vis[v] == 1) continue;
            if (tt - w >= t2) {
                q.push({v, tt - w});
            } else {
                ans.push_back({u, tt});
                ans1.push_back({u, t1});
            }
        }
    }

    for (auto i: ans) q.push(i);
    while (!q.empty()) {
        auto [u, tt] = q.top();
        q.pop();
        if (u == 1) {
            res = max(res, tt);
            continue;
        }
        if (vis[u] == 2) continue;
        vis[u] = 2;

        for (int i = head[u]; ~i; i = e[i].nxt) {
            int v = e[i].v;
            int w = e[i].w2;
            if (vis[v] == 2) continue;
            if (tt <= t1) {
                ans1.push_back({u, tt});
            } else {
                if (tt >= w) {
                    q.push({v, tt - w});
                } else {
                    ans1.push_back({u, t1});
                }
            }
        }
    }

    for (auto i: ans1) q.push(i);
    while (!q.empty()) {
        auto [u, tt] = q.top();
        q.pop();
        if (u == 1) {
            res = max(res, tt);
            continue;
        }
        if (vis[u] == 3) continue;
        vis[u] = 3;

        for (int i = head[u]; ~i; i = e[i].nxt) {
            int v = e[i].v;
            int w = e[i].w1;
            if (vis[v] == 3) continue;
            if (tt - w < 0) continue;
            q.push({v, tt - w});
        }
    }
    cout << res << "\n";
}

signed main() {
#ifdef ONLINE_JUDGE
#else
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 2
100 50 75
1 2 20 50
2 3 40 60
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
# https://codeforces.com/contest/2000

import sys
from heapq import heappush, heappop

input = lambda: sys.stdin.readline().rstrip()  # faster!

INF = 10 ** 18

def dijkstra(n, adj, start, finish, t_start, walk_call, t1, t2):
    dist = [INF] * n
    dist[start] = t_start
    queue = []
    heappush(queue, (dist[start], start))
    while queue:
        d, v = heappop(queue)
        if d == dist[v]:
            for u, l1, l2 in adj[v]:
                if d >= t2 or d + l1 <= t1:
                    if d + l1 < dist[u]:
                        dist[u] = d + l1
                        heappush(queue, (dist[u], u))
                elif walk_call:
                    if d + l2 < dist[u]:
                        dist[u] = d + l2
                        heappush(queue, (dist[u], u))
                else:
                    if t2 + l1 < dist[u]:
                        dist[u] = t2 + l1
                        heappush(queue, (dist[u], u))
    return dist[finish]

def solve_case(t):
    n, m = map(int, input().split())  # 2 <= n <= 10**5, 1 <= m <= 10**5
    t0, t1, t2 = map(int, input().split())  # t1 < t2 < t0

    adj = [[] for _ in range(n)]
    for _ in range(m):
        u, v, l1, l2 = map(int, input().split())
        u -= 1
        v -= 1
        adj[u] += [(v, l1, l2)]
        adj[v] += [(u, l1, l2)]

    if t==24:
        return f"{str(adj[2:4]).replace(', ','_')}"

    start = 0
    finish = n - 1

    x = dijkstra(n, adj, start, finish, 0, True, t1, t2)
    y = dijkstra(n, adj, start, finish, 0, False, t1, t2)
    if min(x, y) > t0:
        return -1

    lo, hi = 0, t0
    while lo + 1 < hi:
        mid = (lo + hi) // 2
        x = dijkstra(n, adj, start, finish, mid, True, t1, t2)
        y = dijkstra(n, adj, start, finish, mid, False, t1, t2)
        xy = min(x, y)
        if xy <= t0:
            lo = mid
        else:
            hi = mid

    return lo

ans = []
for t in range(int(input())):
    ans += [str(solve_case(t))]
print("\n".join(ans))

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3
100 50 60
1 2 40 50
2 3 10 20
1 3 50 60
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
import heapq
import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def make_graph(n, m):
    l = 2 * m + n
    x, y, s = [0] * (2 * l), [0] * (2 * l), [0] * (((n + 1) << 1) + 3)
    for i in range(0, m << 2, 4):
        u, v, l1, l2 = map(int, input().split())
        for k in range(2):
            s[g(u, k) + 2] += 1
            s[g(v, k) + 2] += 1
        x[i ^ 0], x[i ^ 1], x[i ^ 2], x[i ^ 3] = g(u, 0), g(v, 0), g(u, 1), g(v, 1)
        y[i ^ 0], y[i ^ 1], y[i ^ 2], y[i ^ 3] = l1, l1, l2, l2
    k = m << 2
    for i in range(1, n + 1):
        for j in range(2):
            s[g(i, j) + 2] += 1
            x[k ^ j] = g(i, j ^ 1)
        k += 2
    for i in range(3, ((n + 1) << 1) + 3):
        s[i] += s[i - 1]
    G, W = [0] * (2 * l), [0] * (2 * l)
    for i in range(2 * l):
        j = x[i] + 1
        G[s[j]] = x[i ^ 1]
        W[s[j]] = y[i ^ 1]
        s[j] += 1
    return G, W, s

def f(u, v):
    return u << 20 ^ v

def g(u, v):
    return u << 1 ^ v

def dijkstra(s):
    dist = [-1] * (((n + 1) << 1) + 1)
    dist[s] = t0
    visit = [0] * (((n + 1) << 1) + 1)
    p = [f(inf - t0, s)]
    while p:
        d, u = inf - (p[0] >> 20), heapq.heappop(p) & 0xfffff
        if dist[u] < d:
            continue
        if d <= t1:
            x = 0
        elif t1 < d < t2:
            x = 1
        else:
            x = 2
        visit[u] = 1
        for i in range(s0[u], s0[u + 1]):
            v, nd = G[i], dist[u] - W[i]
            if nd <= t1:
                y = 0
            elif t1 < nd < t2:
                y = 1
            else:
                y = 2
            if not u & 1 and not v & 1 and x ^ y:
                nd = t1 - W[i]
            if not visit[v] and nd > dist[v]:
                dist[v] = nd
                heapq.heappush(p, f(inf - dist[v], v))
    return dist

t = int(input())
ans = []
inf = pow(10, 9) + 1
for _ in range(t):
    n, m = map(int, input().split())
    t0, t1, t2 = map(int, input().split())
    G, W, s0 = make_graph(n, m)
    dist = dijkstra(g(n, 0))
    ans0 = dist[2]
    ans.append(ans0)
sys.stdout.write("\n".join(map(str, ans)))

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
4 4
100 50 70
1 2 10 20
2 3 10 20
3 4 10 20
1 4 100 200
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
I = lambda : list(map(int, input().split(' ')))
R = lambda : (int(input()))

import math
from collections import defaultdict
from collections import deque

from heapq import heappop, heappush, heapify

def is_possible(node, e, t0, t1, t2):

    dis = [float('inf') for i in range(n + 1)]
    dis[1] = node[0][0]
    heapify(node)

    ind = 0

    while ind < len(node) :

        # d, curr, parent = heappop(node)
        d, curr, parent = node[ind]
        dis[curr] = min(dis[curr], d)

        for v, l1, l2 in e[curr]:

            if d <= t1:
                time_req = (d + l1) if (d + l1 <= t1) else (d + l2)
                if time_req > t2 + l1: time_req = t2 + l1

            elif d > t1 and d < t2:
                time_req = d + l2
                if time_req > t2 + l1: time_req = t2 + l1

            elif d >= t2:
                time_req = d + l1

            if v != n and v != parent:
                if dis[v] > time_req and dis[v] == float('inf'):
                    # heappush(node, (time_req, v, curr))
                    node.append((time_req, v, curr))
                    dis[v] = min(time_req, dis[v])

            elif v == n and v != parent:
                dis[v] = min(dis[v], time_req)

        ind += 1

    return dis[n] <= t0

for kp in range(R()):

    n,m = I()
    t0, t1, t2 = I()
    e = [[] for i in range(n+1)]

    prev = -1
    low = 0
    high = t0

    for i in range(m):
        u,v,l1,l2 = I()
        e[u].append((v,l1,l2))
        e[v].append((u,l1,l2))

    while low <= high:
        mid = (low + high)//2
        is_d = is_possible( [(mid, 1, -1)] , e, t0, t1, t2)

        if is_d == True:
            prev = mid
            low = mid + 1
        else:
            high = mid - 1

        # print(high, low, mid, is_d)

    print(prev)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 2
100 50 60
1 2 10 20
2 3 10 20
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
//package Codeforces;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;

import java.util.*;

public class CallDuringTheJourney {
    final static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        new Thread(null, null, "Thread", 1 << 27) {
            public void run() {
                try {
                    s = new FastReader();
                    out = new PrintWriter(new BufferedOutputStream(System.out));
                    solve();
                    out.close();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }

    static void solve() throws Exception {

        int testcases =  sc.nextInt();
        for (int test = 0; test<testcases; ++test) {
            int n = sc.nextInt();
            int m = sc.nextInt();

            Graph g = new Graph(n, m);

            int t0 = sc.nextInt();
            int t1 = sc.nextInt();
            int t2 = sc.nextInt();

            for(int i=0; i<m; ++i){
                int u = sc.nextInt();
                int v = sc.nextInt();
                int bussTime = sc.nextInt();
                int walkTime = sc.nextInt();
                g.createEdge(u, v, bussTime, walkTime);
            }

            int result = findTimeToReach(g, t0, t1, t2);
            out.println(result);
        }
    }

    private static int findTimeToReach(Graph g, int t0, int t1, int t2){
        g.populateMaxTimeToReach(t0, t1, t2);
        return g.nodes.get(0).maxTimeTorReach;
    }

    private static boolean isOverlappingInterval(int busTime, int maxTimeTorReach, int t1, int t2) {
        return (t2 > busTime && t1 < maxTimeTorReach);
    }

    public static class Graph{
        List<Node> nodes;
       // List<Edge> edges;
        Map<Node, List<Edge>> adjacencyList;
        static int edgeid = 0;
        int N;
        int M;

        Graph(int N, int M){
            this.N = N;
            this.M = M;
            nodes = new ArrayList<>(this.N);
           // edges = new ArrayList<>(this.M);
            adjacencyList = new HashMap<>();
            for(int i = 0; i < N; i++){
                Node u = new Node(i);
                nodes.add(u);
                adjacencyList.put(u, new ArrayList<>());
            }
        }

        void populateMaxTimeToReach(int t0, int t1, int t2){
            PriorityQueue<Node> pq = new PriorityQueue<>((a, b) -> b.maxTimeTorReach - a.maxTimeTorReach);

//            out.println("Checking PQ");
//            for(int i=1; i<N; i++){
//                nodes.get(i).maxTimeTorReach = i;
//                pq.add(nodes.get(i));
//            }
//            while(!pq.isEmpty()){
//                out.println(pq.poll().maxTimeTorReach);
//            }
//            out.println("done");

            nodes.get(N-1).maxTimeTorReach = t0;
            pq.add(nodes.get(N-1));

            int walkTime, busTime, currentBestTime;

            Set<Integer> visited = new HashSet<>();

            while(!pq.isEmpty()){
                Node node = pq.poll();
                pq.remove(node);
                if(visited.contains(node.id)){ continue;}
                visited.add(node.id);
                if(node.maxTimeTorReach < 0) break;
                if(node.id == 0) break;

                for(Edge edge: adjacencyList.get(node)){
                    Node neib = edge.u;
                    if(edge.u.id == node.id){
                        neib = edge.v;
                    }
                    walkTime = node.maxTimeTorReach - edge.walkTime;
                    busTime = node.maxTimeTorReach - edge.busTime;

                    if(isOverlappingInterval(busTime, node.maxTimeTorReach, t1, t2)){
                        busTime = t1 - edge.busTime;
                    }

                    currentBestTime = Math.max(walkTime, busTime);
                    if(neib.maxTimeTorReach < currentBestTime){
                        neib.maxTimeTorReach = currentBestTime;
                        pq.add(neib);
                    }
                }
            }
        }

        public static class Node{
            int id;
            int maxTimeTorReach;

            Node(int id){
                this.id = id;
                this.maxTimeTorReach = -1;
            }
        }

        public static class Edge{
            int id;
            Node u;
            Node v;
            int walkTime;
            int busTime;

            public Edge(Node u, Node v, int walkTime, int busTime) {
                this.u = u;
                this.v = v;
                this.walkTime = walkTime;
                this.busTime = busTime;
                this.id = edgeid;
                edgeid++;
            }
        }

        void createEdge(int u, int v, int busTime, int walkTime){
            --u; --v;
            Node uNode = nodes.get(u);
            Node vNode = nodes.get(v);

            Edge edge = new Edge(uNode, vNode, walkTime, busTime);
            adjacencyList.get(uNode).add(edge);
            adjacencyList.get(vNode).add(edge);
        }
    }

    public static FastReader s;
    public static PrintWriter out;

    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To create a challenging test input that exposes the bug in the given code, let's consider the following aspects:

1. **Overlap with Phone Call Time**: The code logic for handling the overlap with the phone call time might be flawed. We should create a scenario where the optimal path involves a bus ride that starts before the phone call and ends after it, or a bus ride that starts during the phone call and ends after it.

2. **Edge Case for Early Departure**: Test cases where the earliest departure time is very close to the start of the phone call or the event.

3. **Multiple Paths and Optimal Solution**: Ensure there are multiple paths to the destination to test the correctness of the algorithm in choosing the optimal path.

4. **Small Scale**: Keep the input small but complex enough to challenge the algorithm.

Let's create a test case where the optimal path involves a bus ride that overlaps with the phone call time, and the optimal departure time is close to the start of the phone call.

```plaintext
1
5 5
100 40 60
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
1 5 90 100
```

### Explanation:
- **Number of Test Cases**: 1
- **Number of Intersections (n) and Streets (m)**: 5 intersections and 5 streets
- **Event Time (t0), Phone Call Start (t1), and End (t2)**: The event is at 100 minutes, the phone call starts at 40 minutes, and ends at 60 minutes.
- **Streets**:
  - Street 1: Intersection 1 to Intersection 2, bus time 20, walk time 50
  - Street 2: Intersection 2 to Intersection 3, bus time 20, walk time 50
  - Street 3: Intersection 3 to Intersection 4, bus time 20, walk time 50
  - Street 4: Intersection 4 to Intersection 5, bus time 20, walk time 50
  - Street 5: Intersection 1 to Intersection 5, bus time 90, walk time 100

In this test case:
- The optimal path without considering the phone call would be to take the direct bus from Intersection 1 to Intersection 5, which takes 90 minutes. This would mean leaving at time 10, which is before the phone call starts.
- However, since the phone call is from 40 to 60, the algorithm should consider the path that avoids the bus ride during the phone call. The optimal path in this case is to take the bus from Intersection 1 to Intersection 2, then from Intersection 2 to Intersection 3, then from Intersection 3 to Intersection 4, and finally from Intersection 4 to Intersection 5, which takes a total of 80 minutes. This means the latest time to leave home is 20 minutes, which is after the phone call starts.

This test case should expose any issues in the code's handling of the phone call overlap and the calculation of the optimal path.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
//package Codeforces;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;

import java.util.*;

public class CallDuringTheJourney {
    final static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        new Thread(null, null, "Thread", 1 << 27) {
            public void run() {
                try {
                    s = new FastReader();
                    out = new PrintWriter(new BufferedOutputStream(System.out));
                    solve();
                    out.close();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }

    static void solve() throws Exception {

        int testcases =  sc.nextInt();
        for (int test = 0; test<testcases; ++test) {
            int n = sc.nextInt();
            int m = sc.nextInt();

            Graph g = new Graph(n, m);

            int t0 = sc.nextInt();
            int t1 = sc.nextInt();
            int t2 = sc.nextInt();

            for(int i=0; i<m; ++i){
                int u = sc.nextInt();
                int v = sc.nextInt();
                int bussTime = sc.nextInt();
                int walkTime = sc.nextInt();
                g.createEdge(u, v, bussTime, walkTime);
            }

            int result = findTimeToReach(g, t0, t1, t2);
            out.println(result);
        }
    }

    private static int findTimeToReach(Graph g, int t0, int t1, int t2){
        g.populateMaxTimeToReach(t0, t1, t2);
        return g.nodes.get(0).maxTimeTorReach;
    }

    private static boolean isOverlappingInterval(int busTime, int maxTimeTorReach, int t1, int t2) {
        return (t2 > busTime && t1 < maxTimeTorReach);
    }

    public static class Graph{
        List<Node> nodes;
       // List<Edge> edges;
        Map<Node, List<Edge>> adjacencyList;
        static int edgeid = 0;
        int N;
        int M;

        Graph(int N, int M){
            this.N = N;
            this.M = M;
            nodes = new ArrayList<>(this.N);
           // edges = new ArrayList<>(this.M);
            adjacencyList = new HashMap<>();
            for(int i = 0; i < N; i++){
                Node u = new Node(i);
                nodes.add(u);
                adjacencyList.put(u, new ArrayList<>());
            }
        }

        void populateMaxTimeToReach(int t0, int t1, int t2){
            nodes.get(N-1).maxTimeTorReach = t0;
            PriorityQueue<Node> pq = new PriorityQueue<>();

            pq.add(nodes.get(N-1));
            int walkTime, busTime, currentBestTime;

            while(!pq.isEmpty()){
                Node node = pq.poll();
                if(node.maxTimeTorReach < 0 || node.id == 0) break;
                for(Edge edge: adjacencyList.get(node)){
                    Node neib = edge.u;
                    if(edge.u.id == node.id){
                        neib = edge.v;
                    }
                    walkTime = node.maxTimeTorReach - edge.walkTime;
                    busTime = node.maxTimeTorReach - edge.busTime;

                    if(isOverlappingInterval(busTime, node.maxTimeTorReach, t1, t2)){
                        busTime = t1 - edge.busTime;
                    }

                    currentBestTime = Math.max(walkTime, busTime);
                    if(neib.maxTimeTorReach < currentBestTime){
                        neib.maxTimeTorReach = currentBestTime;
                        pq.add(neib);
                    }
                }
            }
        }

        public static class Node implements Comparable<Node>{
            int id;
            int maxTimeTorReach;

            Node(int id){
                this.id = id;
                this.maxTimeTorReach = -1;
            }

            @Override
            public int compareTo(Node o) {
                return o.maxTimeTorReach - this.maxTimeTorReach ;
            }

        }

        public static class Edge{
            int id;
            Node u;
            Node v;
            int walkTime;
            int busTime;

            public Edge(Node u, Node v, int walkTime, int busTime) {
                this.u = u;
                this.v = v;
                this.walkTime = walkTime;
                this.busTime = busTime;
                this.id = edgeid;
                edgeid++;
            }
        }

        void createEdge(int u, int v, int busTime, int walkTime){
            --u; --v;
            Node uNode = nodes.get(u);
            Node vNode = nodes.get(v);

            Edge edge = new Edge(uNode, vNode, walkTime, busTime);
            adjacencyList.get(uNode).add(edge);
            adjacencyList.get(vNode).add(edge);
        }
    }

    public static FastReader s;
    public static PrintWriter out;

    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided code, we need to consider the following aspects:

1. **Constraints**: Ensure the test input adheres to the given constraints.
2. **Edge Cases**: Focus on edge cases that might cause the algorithm to fail, such as:
   - Minimal time to reach the destination.
   - Overlapping phone call times with bus travel times.
   - Complex graph structures with multiple paths.

Let's construct a test case that challenges the code:

1. **Minimal Time to Reach the Destination**: Create a scenario where the minimal time to reach the destination is very close to the phone call times.
2. **Overlapping Phone Call Times**: Ensure the phone call times overlap with potential bus travel times.
3. **Complex Graph**: Use a simple but non-trivial graph to ensure the algorithm needs to handle multiple paths.

Here is a small-scale test input:

```plaintext
1
4 4
100 50 60
1 2 10 50
2 3 10 50
3 4 10 50
1 4 99 100
```

**Explanation**:
- **Test Case**: 1
- **Intersections and Streets**: 4 intersections and 4 streets.
- **Event and Phone Call Times**: The event is at time 100, the phone call starts at 50 and ends at 60.
- **Streets**:
  - Street 1 connects intersections 1 and 2, with bus time 10 and walk time 50.
  - Street 2 connects intersections 2 and 3, with bus time 10 and walk time 50.
  - Street 3 connects intersections 3 and 4, with bus time 10 and walk time 50.
  - Street 4 connects intersections 1 and 4, with bus time 99 and walk time 100.

This test case is designed to challenge the algorithm because:
- The direct bus path from 1 to 4 takes 99 minutes, which is very close to the phone call times.
- The phone call times (50-60) overlap with the bus travel times on the direct path.
- The indirect path (1 -> 2 -> 3 -> 4) takes 30 minutes by bus, which is a valid alternative but must be considered carefully.

This input should help expose any issues in the algorithm's handling of overlapping times and minimal path calculations.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;
const int maxn = 1e5 + 5, ninf = 0x80000000;
int T, n, m, t0, t1, t2, et[maxn];
struct Edge{
    int to, l1, l2;
    Edge(int to, int l1, int l2){
        this->to = to;
        this->l1 = l1;
        this->l2 = l2;
    }
};
struct Node{
    int idx, t;
    inline bool operator < (const Node &other) const{
        return t < other.t;
    }
    Node(int idx, int t){
        this->idx = idx;
        this->t = t;
    }
};
vector<Edge> to[maxn];
inline void clear_vec(vector<Edge> &vec){
    vector<Edge> empty;
    swap(empty, vec);
}
inline void solve(){
    cin >> n >> m;
    cin >> t0 >> t1 >> t2;
    for(int i = 1; i <= n; ++i)
        clear_vec(to[i]);
    for(int i = 1; i <= n; ++i)
        et[i] = ninf;
    for(int i = 0; i < m; ++i){
        int u, v, l1, l2;
        cin >> u >> v >> l1 >> l2;
        to[u].push_back(Edge(v, l1, l2));
        to[v].push_back(Edge(u, l1, l2));
    }
    priority_queue<Node> pq;
    pq.push(Node(n, t0));
    int rt;
    while(!pq.empty()){
        Node top = pq.top();
        pq.pop();
        // cerr << "VIS: " << top.idx << ' ' << top.t << endl;
        rt = top.t;
        // cerr << et[top.idx] << endl;
        if(et[top.idx] != ninf)
            continue;
        et[top.idx] = rt;
        for(auto e: to[top.idx])
            if(et[e.to] == ninf){
                if(rt <= t1 || rt - e.l1 >= t2)
                    pq.push(Node(e.to, rt - e.l1));
                else
                    pq.push(Node(e.to, max(rt - e.l2, t1 - e.l1)));
            }
    }
    // for(int i = 1; i <= n; ++i)
    //     cerr << et[i] << " ";
    // cerr << endl;
    cout << max(-1, et[1]) << endl;
}
int main(){
    cin.tie(0)->sync_with_stdio(false);
    cin >> T;
    while(T--)
        solve();
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
5 5
100 50 60
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
1 5 30 100
```

### Explanation:
This test case is designed to expose potential issues in the given buggy code. Here's a breakdown:

1. **City Layout**:
   - There are 5 intersections (1 to 5) and 5 streets.
   - Each street has a bus travel time (l1) and a walking travel time (l2).

2. **Event and Phone Call Times**:
   - The event starts at time 100.
   - The phone call starts at time 50 and ends at time 60.

3. **Street Details**:
   - Street 1-2: 20 minutes by bus, 50 minutes by walking.
   - Street 2-3: 20 minutes by bus, 50 minutes by walking.
   - Street 3-4: 20 minutes by bus, 50 minutes by walking.
   - Street 4-5: 20 minutes by bus, 50 minutes by walking.
   - Street 1-5: 30 minutes by bus, 100 minutes by walking.

### Why This Test Case is Challenging:
- **Direct Path with Different Travel Times**: The direct path from intersection 1 to 5 has a bus travel time of 30 minutes and a walking time of 100 minutes. This is shorter than the cumulative bus travel time (80 minutes) via the intermediate intersections.
- **Phone Call Window**: The phone call window (50 to 60) is within the total travel time, making it crucial to check the constraints correctly.
- **Bus and Walking Constraints**: The code must correctly handle the logic of when to use the bus and when to walk, especially during the phone call window.

### Expected Output:
- The latest time you can leave home to reach the event on time and still have the phone call is 40. This is because:
  - If you leave at time 40, you can reach intersection 5 by time 70 (40 + 30) using the direct bus route.
  - The phone call window (50 to 60) does not interfere with this travel plan.

### Potential Bug Exposure:
- The code might incorrectly handle the direct path and the phone call constraints, leading to an incorrect output. For example, it might not consider the direct bus route from 1 to 5, or it might incorrectly handle the phone call window constraints.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
import java.io.*;
import java.util.*;

public class Main {
    public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353;
    public static void main(String args[]){
        try {
            PrintWriter o = new PrintWriter(System.out);
            boolean multiTest = true;
            // init
            if(multiTest) {
                int t = nextInt(), loop = 0;
                while (loop < t) {loop++;solve(o);}
            } else solve(o);
            o.close();
        } catch (Exception e) {e.printStackTrace();}
    }
    static List<int[]>[] G;
    static int n, m;
    static int[] t;
    static void solve(PrintWriter o) {
        try {
            n = nextInt();
            m = nextInt();
            t = new int[3];
            for(int i=0;i<3;i++) t[i] = nextInt();
            G = new ArrayList[n];
            Arrays.setAll(G, key->new ArrayList<>());
            for(int i=0;i<m;i++) {
                int u = nextInt(), v = nextInt();
                u--;v--;
                int l1 = nextInt(), l2 = nextInt();
                G[u].add(new int[]{v, l1, l2});
                G[v].add(new int[]{u, l1, l2});
            }
            int l = 0, r = t[0]+1;
            while(l < r) {
                int mi = (l+r)>>1;
                if(check(mi)) l = mi+1;
                else r = mi;
            }
            if(l == 0) {
                o.println(-1);
                return;
            }
            o.println(l-1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    static boolean check(int m) {
        int[] dist = new int[n];
        Arrays.fill(dist, Integer.MAX_VALUE);
        dist[0] = m;
        PriorityQueue<int[]> queue = new PriorityQueue<>((x,y)->Integer.compare(x[1], y[1]));
        queue.offer(new int[]{0, m});
        while(!queue.isEmpty()) {
            int[] it = queue.poll();
            int u = it[0], now = it[1];
            if(now > dist[u]) continue;
            if(u == n-1) {
                return true;
            }
            for(int[] it1: G[u]) {
                int v = it1[0], w1 = it1[1], w2 = it1[2];
                boolean used = false;
                if(now+w1 <= t[0]) {
                    if((now < t[1] && now+w1 <= t[1] || now >= t[2]) && now+w1 < dist[v]) {
                        dist[v] = now+w1;
                        queue.offer(new int[]{v, now+w1});
                        used = true;
                    }
                }
                if(!used) {
                    int comp1 = Integer.MAX_VALUE, comp2 = Integer.MAX_VALUE;
                    if(now < t[2] && t[2]+w1 <= t[0] && t[2]+w1 < dist[v]) comp1 = t[2]+w1;
                    if(now+w2 <= t[0] && now+w2 < dist[v]) comp2 = now+w2;
                    comp1 = Math.min(comp1, comp2);
                    if(comp1 < dist[v]) queue.offer(new int[]{v, comp1});
                }
            }
        }
        return false;
    }
    public static int upper_bound(int[] a, int val){
        int l = 0, r = a.length;
        while(l < r){
            int mid = l + (r - l) / 2;
            if(a[mid] <= val) l = mid + 1;
            else r = mid;
        }
        return l;
    }
    public static int lower_bound(int[] a, int val){
        int l = 0, r = a.length;
        while(l < r){
            int mid = l + (r - l) / 2;
            if(a[mid] < val) l = mid + 1;
            else r = mid;
        }
        return l;
    }
    public static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a%b);
    }
    public static long[] extgcd(long a, long b) {
        if(b == 0) return new long[]{1, 0};
        long[] it = extgcd(b, a%b);
        long x = it[1], y = it[0];
        y -= a/b*x;
        return new long[]{x, y};
    }
    public static long lcm(long a, long b){
        return a / gcd(a,b)*b;
    }
    public static long qpow(long a, long n, int md){
        a %= md;
        long ret = 1l;
        while(n > 0){
            if((n & 1) == 1) ret = ret * a % md;
            n >>= 1;
            a = a * a % md;
        }
        return ret;
    }
    public static class FenWick {
        int n;
        long[] a;
        long[] tree;
        public FenWick(int n){
            this.n = n;
            a = new long[n+1];
            tree = new long[n+1];
        }
        private void add(int x, long val){
            while(x <= n){
                tree[x] += val;
                x += x&-x;
            }
        }
        private void addMx(int x, long val) {
            a[x] += val;
            tree[x] = a[x];
            while(x <= n) {
                for(int i=1;i<(x&-x);i<<=1) tree[x] = Math.max(tree[x], tree[x-i]);
                x += x&-x;
            }
        }
        private long query(int x){
            long ret = 0l;
            while(x > 0){
                ret += tree[x];
                x -= x&-x;
            }
            return ret;
        }
        private long queryMx(int l, int r) {
            long res = 0l;
            while(l <= r) {
                if(r-(r&-r) >= l) {
                    res = Math.max(res, tree[r]);
                    r -= r&-r;
                }
                else {
                    res = Math.max(res, a[r]);
                    r--;
                }
            }
            return res;
        }
    }
    static class DSU {
        int[] parent;
        public DSU(int n) {
            parent = new int[n];
            for(int i=0;i<n;i++) parent[i] = i;
        }
        public int find(int x) {
            if(parent[x] != x) parent[x] = find(parent[x]);
            return parent[x];
        }
        public void union(int x, int y) {
            int root_x = find(x);
            int root_y = find(y);
            if(root_x == root_y) return;
            parent[root_x] = root_y;
        }
    }
    private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer tokenizer = new StringTokenizer("");
    private static String next() throws IOException{
        while(!tokenizer.hasMoreTokens()){tokenizer = new StringTokenizer(reader.readLine());}
        return tokenizer.nextToken();
    }
    public static int nextInt() throws IOException {return Integer.parseInt(next());}
    public static Long nextLong() throws IOException {return Long.parseLong(next());}
    public static double nextDouble() throws IOException {return Double.parseDouble(next());}
    public static char nextChar() throws IOException {return next().toCharArray()[0];}
    public static String nextString() throws IOException {return next();}
    public static String nextLine() throws IOException {return reader.readLine();}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 2
100 50 60
1 2 40 80
2 3 40 80
```

### Explanation:
1. **Test Case Count**: We use a single test case to keep the input small.
2. **City Structure**:
   - **Intersections**: 3
   - **Streets**: 2
3. **Event and Phone Call Times**:
   - **Event Time**: 100
   - **Phone Call Start**: 50
   - **Phone Call End**: 60
4. **Streets**:
   - **Street 1**: Connects intersections 1 and 2, with bus travel time 40 and walking time 80.
   - **Street 2**: Connects intersections 2 and 3, with bus travel time 40 and walking time 80.

### Why This Test Case?
- **Edge Case for Phone Call**: The phone call duration (50 to 60) is short, and the bus travel times are exactly 40 minutes. This means that if you start at time 0, you will reach intersection 2 at time 40, which is before the phone call starts. You can then take the bus from intersection 2 to intersection 3 at time 80, which is after the phone call ends.
- **Critical Path**: The only path from intersection 1 to intersection 3 is through intersection 2. The bus travel times are such that the phone call times are a critical factor.
- **Challenges the Algorithm**: The algorithm needs to correctly handle the timing constraints, especially the phone call period, to determine the latest time you can leave home.

This test case is designed to expose any issues in the algorithm's handling of the phone call constraints and the timing of bus travel.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
import math
from collections import Counter
import sys
import heapq

input = sys.stdin.readline

t = int(input())

for _ in range(t):
    n, m = map(int, input().split())
    eventTime, startCall, endCall = map(int, input().split())
    neighbourNodes = [[] for i in range(n)]

    for i in range(m):
        path, toPath, durationBus, durationWalk = map(int, input().split())
        path -= 1
        toPath -= 1
        neighbourNodes[path].append([toPath, durationBus, durationWalk])
        neighbourNodes[toPath].append([path, durationBus, durationWalk])

    def solve():

        leftPointer, rightPointer = 0, eventTime

        ans = float('inf')

        def isValid(startTime):

            heap = [[startTime, 0]]
            arrivalTime = [[float('inf'), float('inf')] for i in range(n)]
            arrivalTime[0][1 if startTime >= endCall else 0] = startTime
            while heap:
                currTime, currNode = heapq.heappop(heap)
                for node, durationBus, durationWalk in neighbourNodes[currNode]:
                    if currTime + durationWalk <= startCall or currTime >= endCall:
                        endTime = currTime + durationBus
                        newState = 1 if endTime >= endCall else 0
                        if arrivalTime[node][newState] > endTime:
                            arrivalTime[node][newState] = endTime
                            heapq.heappush(heap, [endTime, node])
                        continue

                    if endCall >= currTime >= startCall or currTime + durationBus > startCall:
                        for endTime in [currTime + durationWalk, endCall + durationBus]:
                            newState = 1 if endTime >= endCall else 0
                            if arrivalTime[node][newState] > endTime:
                                arrivalTime[node][newState] = endTime
                                heapq.heappush(heap, [endTime, node])
                        continue

                    for endTime in [currTime + durationBus, currTime + durationWalk, endCall + durationBus]:
                        newState = 1 if endTime >= endCall else 0

                        if endTime <= currTime:
                            continue
                        if arrivalTime[node][newState] > endTime:
                            arrivalTime[node][newState] = endTime
                            heapq.heappush(heap, [endTime, node])
            return arrivalTime[n - 1][1] <= eventTime or arrivalTime[n - 1][0] <= endCall

        while rightPointer >= leftPointer:
            middlePointer = (leftPointer + rightPointer) // 2

            if isValid(middlePointer):
                ans = middlePointer
                leftPointer = middlePointer + 1
            else:
                rightPointer = middlePointer - 1

        return ans if ans != float('inf') else -1

    print(solve())

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 2
100 50 70
1 2 20 50
2 3 30 60
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Call During the Journey
time_limit_ms: 4000
memory_limit_mb: 256
Description: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.

Every minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.

You can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.

You can make stops at intersections.

You live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).

During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.

Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event?

Input: The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The following are the descriptions of the test cases.

The first line of each test case contains two integers $n$, $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$) — the number of intersections and streets in the city.

The second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \le t_1 < t_2 < t_0 \le 10^9$) — the start time of the event, the start time of the phone call, and its end time, respectively.

The next $m$ lines of each test case contain descriptions of the streets.

The $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$, $1 \le l_{i1} < l_{i2} \le 10^9$) — the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.

It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.

Output: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.

Examples:
input:
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6
output:
0
-1
60
80
53
3
2

Note:

Buggy Code:
# Author : Omm Praksh Sahoo
# Calm, Down... Wrong Submission Have 10 Mins Penalty
import heapq
I = lambda: input()
II = lambda: int(input())
MII = lambda: map(int, input().split())
LI = lambda: list(input().split())
LII = lambda: list(map(int, input().split()))
LGMII = lambda: map(lambda x: int(x) - 1, input().split())
LGLII = lambda: list(map(lambda x: int(x) - 1, input().split()))

inf = float('inf')

# #########################################################################################################
# #-----------------------------------------------Code----------------------------------------------------#
# #########################################################################################################
# #

import heapq

def solve():
    n, m = MII()
    t0, t1, t2 = MII()

    graph = [[] for _ in range(n)]

    for _ in range(m):
        u, v, l1, l2 = MII()
        u -= 1
        v -= 1
        graph[u].append((v, l1, l2))
        graph[v].append((u, l1, l2))

    def by_bus(t_start, t_end):
        return t_end <= t1 or t_start >= t2

    def predicate(start_time):
        pq = [(start_time, 0)]
        dist = [inf] * n
        dist[0] = start_time

        while pq:
            current_time, u = heapq.heappop(pq)

            # Early exit if we reach the destination
            if u == n - 1 and current_time <= t0:
                return True

            if current_time > dist[u]:
                continue

            for v, l1, l2 in graph[u]:
                # Relax the edge with l1
                new_time = current_time + l1
                if by_bus(current_time, new_time) and dist[v] > new_time:
                    dist[v] = new_time
                    heapq.heappush(pq, (new_time, v))

                # Relax the edge with adjusted time
                adjusted_time = max(current_time, t2) + l1
                if dist[v] > adjusted_time:
                    dist[v] = adjusted_time
                    heapq.heappush(pq, (adjusted_time, v))

                # Relax the edge with l2
                new_time_with_l2 = current_time + l2
                if dist[v] > new_time_with_l2:
                    dist[v] = new_time_with_l2
                    heapq.heappush(pq, (new_time_with_l2, v))

        return dist[n - 1] <= t0

    lo, hi = 0, t0
    ans = -1

    while lo <= hi:
        mid = (lo + hi) // 2
        if predicate(mid):
            ans = mid
            lo = mid + 1
        else:
            hi = mid - 1

    return ans

t1 = II()
for _ in range(t1):
    print(solve())

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
```