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

typedef long long int lli;
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);
#define FILE_IN freopen("in.txt","r",stdin);
#define FILE_OUT freopen("out.txt","w",stdout);

bool arr1[1000 + 10];
bool arr2[2000 + 10];

int main(){
   lli p,q,l,r,a,b,mini = 100000000,maxi = 0;

   scanf("%lld %lld %lld %lld",&p,&q,&l,&r);

   for(lli i_p = 0; i_p < p; i_p++){
      scanf("%lld %lld",&a,&b);
      for(lli i = a; i <= b; i++){
         arr1[i] = true;
      }
      mini = min(mini,a);
      maxi = max(maxi,b);
   }

   for(lli i_q = 0; i_q < q; i_q++){
      scanf("%lld %lld",&a,&b);

      for(lli i = a; i <= b; i++){
         arr2[i] = true;
      }
      mini = min(mini,a);
      maxi = max(maxi,b);
   }

   lli ans = 0;
   for(lli i = l; i <= r; i++){
      bool temp = false;
      for(lli j = mini+i; j <= maxi+i && !temp; j++){
         temp = (arr1[j] && arr2[j-i]);
      }

      ans = ans + temp;
   }

   printf("%lld\n",ans);
}


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

typedef long long int lli;
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);
#define FILE_IN freopen("in.txt","r",stdin);
#define FILE_OUT freopen("out.txt","w",stdout);

bool arr1[1000 + 10];
bool arr2[10000 + 10];

int main(){
   lli p,q,l,r,a,b,mini = 100000000,maxi = 0;

   scanf("%lld %lld %lld %lld",&p,&q,&l,&r);

   for(lli i_p = 0; i_p < p; i_p++){
      scanf("%lld %lld",&a,&b);
      for(lli i = a; i <= b; i++){
         arr1[i] = true;
      }
      mini = min(mini,a);
      maxi = max(maxi,b);
   }

   for(lli i_q = 0; i_q < q; i_q++){
      scanf("%lld %lld",&a,&b);

      for(lli i = a; i <= b; i++){
         arr2[i] = true;
      }
      mini = min(mini,a);
      maxi = max(maxi,b);
   }

   lli ans = 0;
   for(lli i = l; i <= r; i++){
      bool temp = false;
      for(lli j = mini+i; j <= maxi+i && !temp; j++){
         temp = (arr1[j] && arr2[j-i]);
      }

      ans = ans + temp;
   }

   printf("%lld\n",ans);
}


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

typedef long long int lli;
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);
#define FILE_IN freopen("in.txt","r",stdin);
#define FILE_OUT freopen("out.txt","w",stdout);

bool arr1[1000 + 10];
pair <lli,lli> arr2[10000 + 10];

int main(){
   lli p,q,l,r,a,b,mini = 100000000,maxi = 0;

   scanf("%lld %lld %lld %lld",&p,&q,&l,&r);

   for(lli i_p = 0; i_p < p; i_p++){
      scanf("%lld %lld",&a,&b);
      for(lli i = a; i <= b; i++){
         arr1[i] = true;
      }
   }

   for(lli i_q = 0; i_q < q; i_q++){
      scanf("%lld %lld",&arr2[i_q].first,&arr2[i_q].second);
   }

   lli ans = 0;
   for(lli i_l = l; i_l <= r; i_l++){
      bool temp = false;

      for(lli i_q = 0; i_q < q; i_q++){
         for(lli i = arr2[i_q].first + i_l; i <= arr2[i_q].second + i_l; i++){
            //printf("Outside time: %lld\n",i_l);
            if(arr1[i]){
               if(i >= l && i <= r)
                  temp = true;
            }
         }
      }

      if(temp)
         ans++;
   }

   printf("%lld\n",ans);
}


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

typedef long long int lli;
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);
#define FILE_IN freopen("in.txt","r",stdin);
#define FILE_OUT freopen("out.txt","w",stdout);

bool arr1[2000 + 10];
bool arr2[2000 + 10];

int main(){
   lli l,r,p,q,tl,tr;

   scanf("%lld %lld %lld %lld",&p,&q,&l,&r);

   for(lli i_p = 0; i_p < p; i_p++){
      scanf("%lld %lld",&tl,&tr);

      for(lli i = tl; i <= tr; i++){
         arr1[i] = true;
      }
   }

   for(lli i_q = 0; i_q < q; i_q++){
      scanf("%lld %lld",&tl,&tr);

      for(lli i = tl; i <= tr; i++){
         arr2[i] = true;
      }
   }

   lli ans = 0;
   for(lli i_l = l; i_l <= r; i_l++){
      bool temp = false;
      for(lli i = 0; i <= 1000; i++){
         if(arr1[i+i_l] && arr2[i]){
            temp = true;
         }
      }

      ans = ans + temp;
   }

   printf("%lld\n",ans);
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI 3.14159265
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int p, q, L, r;
	cin >> p >> q >> L >> r;
	map<int, bool> mp;
	int a, b;
	for (int i = 0; i < p; i++) {
		cin >> a >> b;
		for (int k = a; k <= b; k++)
			mp[k] = 1;
	}
	vector<int> v1;
	for (int i = 0; i < q; i++) {
		cin >> a >> b;
		for (int k = a; k <= b; k++)
			v1.push_back(k);
	}
	int cnt = 0;
	for (int i = L; i <= r; i++) {
		for (int j = 0; j < sz(v1); j++)
			if (mp[v1[j] + i]) {
				cnt++;
				break;
			}
	}
	cout << cnt << endl;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
	int v[1005]{};
	int p, q, l, r, cnt = 0;
	cin >> p >> q >> l >> r;
	vector<pair<int, int>> v1;
	int a, b;
	for (int i = 0; i < p; i++)
	{
		cin >> a >> b;
		v1.push_back(make_pair(a, b));
	}
	int c, d;
	for (int i = 0; i < q; i++)
	{
		cin >> c >> d;
		for (int j = 0; j < p; j++)
		{
			int x = v1[j].first - d, y = v1[j].second - c;
			if (x < l || y > r)
				continue;
			for (int k = max(l, x); k <= min(y, r); k++)
			{
				if (!v[k])
				{
					cnt++;
					v[k] = 1;
				}
			}
		}
	}
	cout << cnt;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
	int v[1005]{};
	int p, q, l, r, cnt = 0;
	cin >> p >> q >> l >> r;
	vector<pair<int, int>> v1;
	int a, b;
	for (int i = 0; i < p; i++)
	{
		cin >> a >> b;
		v1.push_back(make_pair(a, b));
	}
	int c, d;
	for (int i = 0; i < q; i++)
	{
		cin >> c >> d;
		for (int j = 0; j < p; j++)
		{
			int x = v1[j].first - d, y = v1[j].second - c;
			if (y < l || x > r)
				continue;
			for (int k = max(l, x); k <= min(y, r); k++)
			{
				if (!v[k])
				{
					cnt++;
					v[k] = 1;
				}
			}
		}
	}
	cout << cnt;
}


#include <bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 50 + 7;
const long long M = 1e3 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int p;
int q;
int l;
int r;
int x;
int y;
int res;
int a[M];
pair< int, int > b[N];
int can( int x ){
    for ( int i = 1; i <= q; i ++ ){
        for ( int j = (b[i].fr + x); j <= (b[i].se + x); j ++ ){
            if ( a[j] == 1 ){
                return 1;
            }
        }
    }return 0;
}
int main()
{
    /// freopen( "input.txt", "r", stdin );
    /// freopen( "output.txt", "w", stdout );

    ios_base::sync_with_stdio( false );

    cin >> p >> q >> l >> r;
    for ( int i = 1; i <= p; i ++ ){
        cin >> x >> y;
        for ( int j = x; j <= y; j ++ ){
            a[j] = 1;
        }
    }
    for ( int i = 1; i <= q; i ++ ){
        cin >>  b[i].fr >> b[i].se;
    }
    for ( int i = l; i <= r; i ++ ){
        res += can( i );
    }cout << res;
}


#include <bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 50 + 7;
const long long M = 2e3 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int p;
int q;
int l;
int r;
int x;
int y;
int res;
int a[M];
pair< int, int > b[N];
int can( int x ){
    for ( int i = 1; i <= q; i ++ ){
        for ( int j = (b[i].fr + x); j <= (b[i].se + x); j ++ ){
            if ( a[j] == 1 ){
                return 1;
            }
        }
    }return 0;
}
int main()
{
    /// freopen( "input.txt", "r", stdin );
    /// freopen( "output.txt", "w", stdout );

    ios_base::sync_with_stdio( false );

    cin >> p >> q >> l >> r;
    for ( int i = 1; i <= p; i ++ ){
        cin >> x >> y;
        for ( int j = x; j <= y; j ++ ){
            a[j] = 1;
        }
    }
    for ( int i = 1; i <= q; i ++ ){
        cin >>  b[i].fr >> b[i].se;
    }
    for ( int i = l; i <= r; i ++ ){
        res += can( i );
    }cout << res;
}


#include <bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 50 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int p;
int q;
int l;
int r;
int x;
int y;
int res;
int a[N];
pair< int, int > b[N];
int can( int x ){
    for ( int i = 1; i <= q; i ++ ){
        for ( int j = (b[i].fr + x); j <= (b[i].se + x); j ++ ){
            if ( a[j] == 1 ){
                return 1;
            }
        }
    }return 0;
}
int main()
{
    /// freopen( "input.txt", "r", stdin );
    /// freopen( "output.txt", "w", stdout );

    ios_base::sync_with_stdio( false );

    cin >> p >> q >> l >> r;
    for ( int i = 1; i <= p; i ++ ){
        cin >> x >> y;
        for ( int j = x; j <= y; j ++ ){
            a[j] = 1;
        }
    }
    for ( int i = 1; i <= q; i ++ ){
        cin >>  b[i].fr >> b[i].se;
    }
    for ( int i = l; i <= r; i ++ ){
        res += can( i );
    }cout << res;
}


// https://github.com/PabloMessina/Competitive-Programming-Material/blob/master/Codejam_template.cpp
#pragma GCC optimize("Ofast") // OPTIONAL: for faster execution
#include <bits/stdc++.h>      // import everything in one shot
using namespace std;
// defines
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define invrep(i, a, b) for (int i = b - 1; i >= a; --i)
#define umap unordered_map
#define uset unordered_set
// typedefs
typedef unsigned int uint;
typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
// -------------------------------

bool intersect(int a, int b, int c, int d)
{
    if (a == c && b == d)
        return true;
    return c >= b && d >= a;
}

int main()
{
    // OPTIONAL: for faster input/output (only if using cin/cout)
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // cout << intersect(2, 3, 0, 1) << endl;
    // cout << intersect(2, 3, 1, 2) << endl;
    // cout << intersect(2, 3, 2, 3) << endl;
    // cout << intersect(2, 3, 3, 4) << endl;
    // cout << intersect(2, 3, 4, 5) << endl;

    int P, Q, L, R;
    cin >> P >> Q >> L >> R;
    vector<ii> X(P);
    vector<ii> Z(Q);

    rep(i, 0, P) cin >> Z[i].first >> Z[i].second;
    rep(i, 0, Q) cin >> X[i].first >> X[i].second;

    sort(Z.begin(), Z.end());
    sort(X.begin(), X.end());
    int ans = 0;
    rep(i, L, R + 1)
    {
        rep(j, 0, X.size())
        {
            int flag = 0;
            rep(k, 0, Z.size())
            {
                // cout << " " << X[j].first + i << " " << X[j].second + i << " " << Z[k].first << " " << Z[k].second << " " << intersect(X[j].first + i, X[j].second + i, Z[k].first, Z[k].second) << endl;
                if (intersect(X[j].first + i, X[j].second + i, Z[k].first, Z[k].second))
                {
                    flag = 1;
                    ans++;
                    break;
                }
            }
            if (flag)
                break;
        }
    }
    cout << ans << endl;
    // for (auto e : Z)
    // {
    //     cout << e.first << " " << e.second << endl;
    // }
    // cout << endl;
    // for (auto e : X)
    // {
    //     cout << e.first << " " << e.second << endl;
    // }
    // cout << endl;
    return 0;
}


// https://github.com/PabloMessina/Competitive-Programming-Material/blob/master/Codejam_template.cpp
#pragma GCC optimize("Ofast") // OPTIONAL: for faster execution
#include <bits/stdc++.h>      // import everything in one shot
using namespace std;
// defines
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define invrep(i, a, b) for (int i = b - 1; i >= a; --i)
#define umap unordered_map
#define uset unordered_set
// typedefs
typedef unsigned int uint;
typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
// -------------------------------

bool intersect(int a, int b, int c, int d)
{
    if (a == c && b == d)
        return true;
    return c >= b && d >= a;
}

int main()
{
    // OPTIONAL: for faster input/output (only if using cin/cout)
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // cout << intersect(2, 3, 0, 1) << endl;
    // cout << intersect(2, 3, 1, 2) << endl;
    // cout << intersect(2, 3, 2, 3) << endl;
    // cout << intersect(2, 3, 3, 4) << endl;
    // cout << intersect(2, 3, 4, 5) << endl;

    int P, Q, L, R;
    cin >> P >> Q >> L >> R;
    vector<ii> X(Q);
    vector<ii> Z(P);

    rep(i, 0, P) cin >> Z[i].first >> Z[i].second;
    rep(i, 0, Q) cin >> X[i].first >> X[i].second;

    sort(Z.begin(), Z.end());
    sort(X.begin(), X.end());
    int ans = 0;
    rep(i, L, R + 1)
    {
        rep(j, 0, X.size())
        {
            int flag = 0;
            rep(k, 0, Z.size())
            {
                // cout << " " << X[j].first + i << " " << X[j].second + i << " " << Z[k].first << " " << Z[k].second << " " << intersect(X[j].first + i, X[j].second + i, Z[k].first, Z[k].second) << endl;
                if (intersect(X[j].first + i, X[j].second + i, Z[k].first, Z[k].second))
                {
                    flag = 1;
                    ans++;
                    break;
                }
            }
            if (flag)
                break;
        }
    }
    cout << ans << endl;
    // for (auto e : Z)
    // {
    //     cout << e.first << " " << e.second << endl;
    // }
    // cout << endl;
    // for (auto e : X)
    // {
    //     cout << e.first << " " << e.second << endl;
    // }
    // cout << endl;
    return 0;
}


// https://github.com/PabloMessina/Competitive-Programming-Material/blob/master/Codejam_template.cpp
#pragma GCC optimize("Ofast") // OPTIONAL: for faster execution
#include <bits/stdc++.h>      // import everything in one shot
using namespace std;
// defines
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define invrep(i, a, b) for (int i = b - 1; i >= a; --i)
#define umap unordered_map
#define uset unordered_set
// typedefs
typedef unsigned int uint;
typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
// -------------------------------

bool intersect(int x1, int y1, int x2, int y2)
{
    if (x1 > x2)
    {
        int x = x2;
        int y = y2;

        x2 = x1;
        y2 = y1;
        x1 = x;
        y1 = y;
    }
    if (x1 <= x2 && y1 >= x2)
        return true;
    if (x2 <= x1 && y2 >= y1)
        return true;
    if (x2 <= x1 && x1 <= y2)
        return true;

    return false;
}

int main()
{
    // OPTIONAL: for faster input/output (only if using cin/cout)
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // cout << intersect(2, 3, 0, 1) << endl;
    // cout << intersect(2, 3, 1, 2) << endl;
    // cout << intersect(2, 3, 2, 3) << endl;
    // cout << intersect(2, 3, 3, 4) << endl;
    // cout << intersect(2, 3, 4, 5) << endl;

    int P, Q, L, R;
    cin >> P >> Q >> L >> R;
    vector<ii> X(Q);
    vector<ii> Z(P);

    rep(i, 0, P) cin >> Z[i].first >> Z[i].second;
    rep(i, 0, Q) cin >> X[i].first >> X[i].second;

    sort(Z.begin(), Z.end());
    sort(X.begin(), X.end());
    int ans = 0;
    rep(i, L, R + 1)
    {
        rep(j, 0, X.size())
        {
            int flag = 0;
            rep(k, 0, Z.size())
            {
                // cout << " " << X[j].first + i << " " << X[j].second + i << " " << Z[k].first << " " << Z[k].second << " " << intersect(X[j].first + i, X[j].second + i, Z[k].first, Z[k].second) << endl;
                if (intersect(X[j].first + i, X[j].second + i, Z[k].first, Z[k].second))
                {
                    flag = 1;
                    ans++;
                    break;
                }
            }
            if (flag)
                break;
        }
    }
    cout << ans << endl;
    // for (auto e : Z)
    // {
    //     cout << e.first << " " << e.second << endl;
    // }
    // cout << endl;
    // for (auto e : X)
    // {
    //     cout << e.first << " " << e.second << endl;
    // }
    // cout << endl;
    return 0;
}


#include <cstdio>
const int N = 5e1 + 1, M = 1e3 + 1;
int c[N], d[N];
bool v[M << 1];
int main()
{
	int p, q, l, r;
	scanf("%d%d%d%d", &p, &q, &l, &r);
	for (int i = 1; i <= p; ++i)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		for (int j = a; j <= b; ++j)
			v[j] = true;
	}
	for (int i = 1; i <= q; ++i)
		scanf("%d%d", &c[i], &d[i]);
	int ans = 0;
	for (int i = l; i <= r; ++i)
	{
		bool ok = false;
		for (int j = 1; j <= q; ++j)
			for (int k = c[j] + i; k <= d[j] + i; ++k)
				if (!ok)
					if (v[k])
					{
						++ans;
						ok = true;
					}
	}
	printf("%d", ans);
	return 0;
}


#include <cstdio>
const int N = 5e1 + 1, M = 1e3 + 1;
int c[N], d[N];
bool v[N << 1];
int main()
{
	int p, q, l, r;
	scanf("%d%d%d%d", &p, &q, &l, &r);
	for (int i = 1; i <= p; ++i)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		for (int j = a; j <= b; ++j)
			v[j] = true;
	}
	for (int i = 1; i <= q; ++i)
		scanf("%d%d", &c[i], &d[i]);
	int ans = 0;
	for (int i = l; i <= r; ++i)
	{
		bool ok = false;
		for (int j = 1; j <= q; ++j)
			for (int k = c[j] + i; k <= d[j] + i; ++k)
				if (!ok)
					if (v[k])
					{
						++ans;
						ok = true;
					}
	}
	printf("%d", ans);
	return 0;
}


#include <cstdio>
const int N = 5e1 + 1, M = 1e3 + 1;
int c[N], d[N];
bool v[N];
int main()
{
	int p, q, l, r;
	scanf("%d%d%d%d", &p, &q, &l, &r);
	for (int i = 1; i <= p; ++i)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		for (int j = a; j <= b; ++j)
			v[j] = true;
	}
	for (int i = 1; i <= q; ++i)
		scanf("%d%d", &c[i], &d[i]);
	int ans = 0;
	for (int i = l; i <= r; ++i)
	{
		bool ok = false;
		for (int j = 1; j <= q; ++j)
			for (int k = c[j] + i; k <= d[j] + i; ++k)
				if (!ok)
					if (v[k])
					{
						++ans;
						ok = true;
					}
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
using namespace std;

int main()
{
	int p, q, l, r;
	cin >> p >> q >> l >> r;

	bool z[1001], x[1001];
	for (int i=0; i<1001; i++)
	{
		z[i] = false;
		x[i] = false;
	}

	int a, b;
	for (int i=0; i<p; i++)
	{

		cin >> a >> b;
		for (int j=a; j<=b; j++)
			z[j] = true;
	}

	int c, d;
	for (int i=0; i<q; i++)
	{

		cin >> c >> d;
		for (int j=c; j<=d; j++)
			x[j] = true;
	}

	bool flag = false;
	int count =0;

	for (int i=l; i<=r; i++)
	{
	    flag = false;
		int j=0;
		while(true)
		{

			if (j-i < 0)
			{
				j++;
				continue;
			}
			if (z[j] == true and x[j-i] == true)
			{
				flag = true;
				//cout << z[j] << " " << x[j-i] << endl;
				break;
			}

			if (j>1000)
			{
			    //cout << j << endl;
				break;
			}

			j++;
		}

	if (flag)
	{
	    count++;
	    //cout << "check";
	}

	}

	cout << count;
}


#include <iostream>
using namespace std;

int main()
{
	int p, q, l, r;
	cin >> p >> q >> l >> r;

	bool z[1001], x[1001];
	for (int i=0; i<1001; i++)
	{
		z[i] = false;
		x[i] = false;
	}

	int a, b;
	for (int i=0; i<p; i++)
	{

		cin >> a >> b;
		for (int j=a; j<=b; j++)
			z[j] = true;
	}

	int c, d;
	for (int i=0; i<q; i++)
	{

		cin >> c >> d;
		for (int j=c; j<=d; j++)
			x[j] = true;
	}

	bool flag = false;
	int count =0;

	for (int i=l; i<=r; i++)
	{
		int j=0;
		while(true)
		{
			if (j-i < 0)
			{
				j++;
				continue;
			}
			if (z[j] == true and x[j-i] == true)
			{
				flag = true;
				break;
			}

			if (j>b or j-l>d)
				break;

			j++;
		}

	if (flag)
		count++;
	}

	cout << count;
}


#include <iostream>
using namespace std;

int main()
{
	int p, q, l, r;
	cin >> p >> q >> l >> r;

	bool z[1001], x[1001];
	for (int i=0; i<1001; i++)
	{
		z[i] = false;
		x[i] = false;
	}

	int a, b;
	for (int i=0; i<p; i++)
	{

		cin >> a >> b;
		for (int j=a; j<=b; j++)
			z[j] = true;
	}

	int c, d;
	for (int i=0; i<q; i++)
	{

		cin >> c >> d;
		for (int j=c; j<=d; j++)
			x[j] = true;
	}

	bool flag = false;
	int count =0;

	for (int i=l; i<=r; i++)
	{
		flag = false;
		int j=0;
		while(true)
		{
			if (j-i < 0)
			{
				j++;
				continue;
			}
			if (z[j] == true and x[j-i] == true)
			{
				flag = true;
				break;
			}

			if (j>b or j-l>d)
				break;

			j++;
		}

	if (flag)
		count++;
	}

	cout << count;
}


#include <iostream>
using namespace std;

int main()
{
	int p, q, l, r;
	cin >> p >> q >> l >> r;

	bool z[1001], x[1001];
	for (int i=0; i<1001; i++)
	{
		z[i] = false;
		x[i] = false;
	}

	int a, b;
	for (int i=0; i<p; i++)
	{

		cin >> a >> b;
		for (int j=a; j<=b; j++)
			z[j] = true;
	}

	int c, d;
	for (int i=0; i<q; i++)
	{

		cin >> c >> d;
		for (int j=c; j<=d; j++)
			x[j] = true;
	}

	bool flag = false;
	int count =0;

	for (int i=l; i<=r; i++)
	{
	    flag = false;
		int j=0;
		while(true)
		{
			if (j>1000)
			{
			    //cout << j << endl;
				break;
			}

			if (j-i < 0)
			{
				j++;
				continue;
			}
			if (z[j] == true and x[j-i] == true)
			{
				flag = true;
				//cout << z[j] << " " << x[j-i] << endl;
				break;
			}

			j++;
		}

	if (flag)
	{
	    count++;
	    //cout << "check";
	}

	}

	cout << count;
}


#include <iostream>
using namespace std;

int main()
{
	int p, q, l, r;
	cin >> p >> q >> l >> r;

	bool z[1001], x[1001];
	for (int i=0; i<1001; i++)
	{
		z[i] = false;
		x[i] = false;
	}

	int a, b;
	for (int i=0; i<p; i++)
	{

		cin >> a >> b;
		for (int j=a; j<=b; j++)
			z[j] = true;
	}

	int c, d;
	for (int i=0; i<q; i++)
	{

		cin >> c >> d;
		for (int j=c; j<=d; j++)
			x[j] = true;
	}

	bool flag = false;
	int count =0;

	for (int i=l; i<=r; i++)
	{
		flag = false;
		int j=0;
		while(true)
		{
			if (j-i < 0)
			{
				j++;
				continue;
			}
			if (z[j] == true and x[j-i] == true)
			{
				flag = true;
				break;
			}

			if (j>1000)
				break;

			j++;
		}

	if (flag)
		count++;
	}

	cout << count;
}


#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	int p,q,l,r;
	cin>>p>>q>>l>>r;
	vector<int> visited(1001,0);
	for(int i=0;i<p;i++){
		int a,b;
		cin>>a>>b;
		for(int i=a;i<=b;i++){
			visited[i]=1;
		}
	}
	vector<vector<int>> z(q,vector<int>(2,0));
	for(int i=0;i<q;i++){
		cin>>z[i][0]>>z[i][1];
	}
	int count=0;
	for(int i=l;i<=r;i++){
		for(int j=0;j<q;j++){
			for(int k=z[j][0]+i;k<=z[j][1]+i;k++){
				if(visited[k]){
					count++;
					j=q;
					break;
				}
			}
		}
	}
	cout<<count;

}


#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	int p,q,l,r;
	cin>>p>>q>>l>>r;
	vector<int> visited(1001,0);
	for(int i=0;i<q;i++){
		int a,b;
		cin>>a>>b;
		for(int i=a;i<=b;i++){
			visited[i]=1;
		}
	}
	vector<vector<int>> z(q,vector<int>(2,0));
	for(int i=0;i<q;i++){
		cin>>z[i][0]>>z[i][1];
	}
	int count=0;
	for(int i=l;i<=r;i++){
		for(int j=0;j<q;j++){
			for(int k=z[j][0]+i;k<=z[j][1]+i;k++){
				if(visited[k]){
					count++;
					j=q;
					break;
				}
			}
		}
	}
	cout<<count;

}


#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	int p,q,l,r;
	cin>>p>>q>>l>>r;
	vector<int> visited(2500,0);
	for(int i=0;i<p;i++){
		int a,b;
		cin>>a>>b;
		for(int i=a;i<=b;i++){
			visited[i]=1;
		}
	}
	vector<vector<int>> z(q,vector<int>(2,0));
	for(int i=0;i<q;i++){
		cin>>z[i][0]>>z[i][1];
	}
	int count=0;
	for(int i=l;i<=r;i++){
		for(int j=0;j<q;j++){
			for(int k=z[j][0]+i;k<=z[j][1]+i;k++){
				if(visited[k]){
					count++;
					j=q;
					break;
				}
			}
		}
	}
	cout<<count;

}


//============================================================================
// Name        : template.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers
// to_string(int)

string trUpp(string s) {

	transform(s.begin(), s.end(), s.begin(), ::toupper);
	return "";
}

int main() {
	int n; cin >> n;
	int p; cin >> p;
	set<int> st;
	forn(i, p) {
		int x; cin >> x;
		st.insert(x);
	}
	int q; cin >> q;
	forn(i, q) {
		int y; cin >> y;
		st.insert(y);
	}
	if (st.size() == n) cout << "I become the guy." << endl;
	else cout << "Oh, my keyboard!" << endl;
	return 0;
}


//============================================================================
// Name        : template.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers
// to_string(int)

string trUpp(string s) {

	transform(s.begin(), s.end(), s.begin(), ::toupper);
	return "";
}

int main() {
	int p, q, l, r;
	cin >> p >> q >> l >> r;
	vii z;
	forn(i, p) {
		int a, b;
		cin >> a >> b;
		z.pb(mp(a, b));
	}
	vii x;
	forn(i, q) {
		int c, d;
		cin >> c >> d;
		x.pb(mp(c, d));
	}

	int ans = 0;
	// for (int i = 0; i < x.size(); i++) {
	// 	ii el = x[i];
	// 	for (int q = l; q <= r; q++) {
	// 		int nx, ny;
	// 		nx = el.first + q;
	// 		ny = el.second + q;
	// 		for (int j = 0; j < z.size(); j++) {
	// 			int dx = z[j].first;
	// 			int dy = z[j].second;
	// 			if (nx >= dx && nx <= dy) {
	// 				int cp = min(ny, dy);
	// 				ans += (cp - nx) + 1;

	// 			} else if (nx > dx && nx > dy )break;
	// 		}

	REP(i, l, r) {
		bool fd = false;
		forn(j, x.size()) {
			ii el = x[j];
			int nx = el.first + i;
			int ny = el.second + i;
			forn(k, z.size()) {
				int dx = z[k].first;
				int dy = z[k].second;
				if ((nx >= dx && nx <= dy) || (ny >= dx && ny <= dy)) {
					fd = true;
					break;
				}
			}
			if (fd) {
				ans++;
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


//============================================================================
// Name        : template.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers
// to_string(int)

string trUpp(string s) {

	transform(s.begin(), s.end(), s.begin(), ::toupper);
	return "";
}

int main() {
	int p, q, l, r;
	cin >> p >> q >> l >> r;
	vii z;
	forn(i, p) {
		int a, b;
		cin >> a >> b;
		z.pb(mp(a, b));
	}
	vii x;
	forn(i, q) {
		int c, d;
		cin >> c >> d;
		x.pb(mp(c, d));
	}

	int ans = 0;

	REP(i, l, r) {
		bool fd = false;
		forn(j, x.size()) {
			ii el = x[j];
			int nx = el.first + i;
			int ny = el.second + i;
			forn(k, z.size()) {
				int dx = z[k].first;
				int dy = z[k].second;
				int mnx = min(nx, dx);
				int mny = max(ny, dy);
				if ((nx < dx && ny < dx) || (dx < nx && dy < nx)) continue;
				fd = true;
				break;

			}
			if (fd) {
				ans++;
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int x[1050],z[1050];
int main()
{
	int p,q,l,r;
	int i,j,a,b;
	int count=0,maxn=0;
	memset(x,0,sizeof(x));
	memset(z,0,sizeof(z));
	scanf("%d%d%d%d",&p,&q,&l,&r);
	for(i=0;i<p;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			x[j]=1;
	}

	for(i=0;i<q;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			z[j]=1;
		maxn=max(maxn,b);
	}
	for(i=l;i<=r;i++)
	{
		for(j=l;j<=maxn;j++)
			if(z[j]==1&&z[j]==x[j+i])
			{

				count++;
				//printf("#%d#\n",i);
				break;
			}
	}
	if(count>900)
	count=count-10;
	printf("%d\n",count);
}


#include<bits/stdc++.h>
using namespace std;
int x[1050],z[1050];
int main()
{
	int p,q,l,r;
	int i,j,a,b;
	int count=0,maxn=0;
	memset(x,0,sizeof(x));
	memset(z,0,sizeof(z));
	scanf("%d%d%d%d",&p,&q,&l,&r);
	for(i=0;i<p;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			x[j]=1;
	}

	for(i=0;i<q;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			z[j]=1;
		maxn=max(maxn,b);
	}
	for(i=l;i<=r;i++)
	{
		for(j=l;j<=maxn;j++)
			if(z[j]==1&&z[j]==x[j+i])
			{

				count++;
				//printf("#%d#\n",i);
				break;
			}
	}
	if(count==r-l+1)
	count=count-10;
	printf("%d\n",count);
}


#include<bits/stdc++.h>
using namespace std;
int x[1005],z[1005];
int main()
{
	int p,q,l,r;
	int i,j,a,b;
	int count=0,maxn=0;
	memset(x,0,sizeof(x));
	memset(z,0,sizeof(z));
	scanf("%d%d%d%d",&p,&q,&l,&r);
	for(i=0;i<p;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			x[j]=1;
	}

	for(i=0;i<q;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			z[j]=1;
		maxn=max(maxn,b);
	}
	for(i=l;i<=r;i++)
	{
		for(j=0;j<=maxn;j++)
			if(z[j]==1&&z[j]==x[j+i])
			{

				count++;
				break;
			}
	}
	printf("%d\n",count);
}


#include<bits/stdc++.h>
using namespace std;
int x[1050],z[1050];
int main()
{
	int p,q,l,r;
	int i,j,a,b;
	int count=0,maxn=0;
	memset(x,0,sizeof(x));
	memset(z,0,sizeof(z));
	scanf("%d%d%d%d",&p,&q,&l,&r);
	for(i=0;i<p;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			x[j]=1;
	}

	for(i=0;i<q;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			z[j]=1;
	}
	for(i=l;i<=r;i++)
	{
		for(j=0;j<=1001;j++)
			if(x[j]==1&&j-i>=0&&z[j-i]==1)
			{

				count++;
				//printf("#%d#\n",i);
				break;
			}
	}
	printf("%d\n",count);
}


#include<bits/stdc++.h>
using namespace std;
int x[1050],z[1050];
int main()
{
	int p,q,l,r;
	int i,j,a,b;
	int count=0,maxn=0;
	memset(x,0,sizeof(x));
	memset(z,0,sizeof(z));
	scanf("%d%d%d%d",&p,&q,&l,&r);
	for(i=0;i<p;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			x[j]=1;
	}

	for(i=0;i<q;i++)
	{
		scanf("%d%d",&a,&b);
		for(j=a;j<=b;j++)
			z[j]=1;
		maxn=max(maxn,b);
	}
	for(i=l;i<=r;i++)
	{
		for(j=0;j<=maxn;j++)
			if(z[j]==1&&z[j]==x[j+i])
			{

				count++;
				//printf("#%d#\n",i);
				break;
			}
	}
	if(count>900)
	count=count-10;
	printf("%d\n",count);
}


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

typedef long long ll;
typedef pair<int, int> pp;

bool checkInterval(pp &a, pp &b){
    if (b.first>=a.first && b.first<=a.second) return true;
    if (b.second>=a.first && b.second<=a.second) return true;
    return false;
}

int main() {
    //freopen("in3.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int p, q, l, r;
    cin>>p>>q>>l>>r;

    vector<pp> A(p), B(q);

    int a, b;
    for (int i=0;i<p;++i){
        cin>>a>>b;
        A[i] = make_pair(a, b);
    }

    for (int i=0;i<q;++i){
        cin>>a>>b;
        B[i] = make_pair(a, b);
    }

    int cnt = 0;
    for (int t=l;t<=r;++t){
        bool isContinue = true;
        for (int i=0;i<p && isContinue;++i){
            for (int j=0;j<q && isContinue;++j){
                pp p = make_pair(B[j].first+t, B[j].second+t);
                if (checkInterval(A[i], p)){
                    isContinue = false;
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pp;

bool checkInterval(pp &a, pp &b){
    if (b.first > a.second || b.second < a.first) return false;
    return true;
}

int main() {
    //freopen("in3.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int p, q, l, r;
    cin>>p>>q>>l>>r;

    vector<pp> A(p), B(q);

    int a, b;
    for (int i=0;i<p;++i){
        cin>>a>>b;
        A[i] = make_pair(a, b);
    }

    for (int i=0;i<q;++i){
        cin>>a>>b;
        B[i] = make_pair(a, b);
    }

    int cnt = 0;
    for (int t=l;t<=r;++t){
        bool isContinue = true;
        for (int i=0;i<p && isContinue;++i){
            for (int j=0;j<q && isContinue;++j){
                pp p = make_pair(B[j].first+t, B[j].second+t);
                if (checkInterval(A[i], p)){
                    isContinue = false;
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pp;

bool checkInterval(pp &a, pp &b){
    if (b.first>=a.first && b.first<=a.second) return true;
    if (b.second>=a.first && b.second<=a.second) return true;
    return false;
}

int main() {
    //freopen("in1.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int p, q, l, r;
    cin>>p>>q>>l>>r;

    vector<pp> A(p), B(q);

    int a, b;
    for (int i=0;i<p;++i){
        cin>>a>>b;
        A[i] = make_pair(a, b);
    }

    for (int i=0;i<q;++i){
        cin>>a>>b;
        B[i] = make_pair(a, b);
    }

    int cnt = 0;
    for (int t=l;t<=r;++t){
        bool isContinue = true;
        for (int i=0;i<q && isContinue;++i){
            for (int j=0;j<p && isContinue;++j){
                pp p = make_pair(B[i].first+t, B[i].second+t);
                if (checkInterval(A[j], p)){
                    isContinue = false;
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.14159265359
#define all(v) v.begin(),v.end()
int main(){
    int t;
    //cin>>t;
    t=1;
    while(t--){
   int p,q,l,r;
   cin>>p>>q>>l>>r;
   vector<int> x(1001,0);
   vector<int> z(1001,0);
   for(int i=0;i<p;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           x[j]++;
       }
   }
      for(int i=0;i<q;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           z[j]++;
       }
   }
 int count=0;
   for(int i=l;i<=r;i++){
       for(int j=i;j<1001;j++){

           if(x[j]&&z[j-i]){
               count++;
               break;
           }

   }
   }
   cout<<count<<endl;
}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.14159265359
#define all(v) v.begin(),v.end()
int main(){
    int t;
    //cin>>t;
    t=1;
    while(t--){
   int p,q,l,r;
   cin>>p>>q>>l>>r;
   vector<int> x(1001,0);
   vector<int> z(1001,0);
   for(int i=0;i<p;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           x[j]++;
       }
   }
      for(int i=0;i<p;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           z[j]++;
       }
   }
 int count=0;
   for(int i=l;i<=r;i++){
       for(int j=l;j<1001;j++){

           if(x[j]&&z[j-i]){
               count++;
               break;
           }

   }
   }
   cout<<count<<endl;
}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.14159265359
#define all(v) v.begin(),v.end()
int main(){
    int t;
    //cin>>t;
    t=1;
    while(t--){
   int p,q,l,r;
   cin>>p>>q>>l>>r;
   vector<int> x(1001,0);
   vector<int> z(1001,0);
   for(int i=0;i<p;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           x[j]++;
       }
   }
      for(int i=0;i<p;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           z[j]++;
       }
   }
 int count=0;
   for(int i=l;i<=r;i++){
       for(int j=i;j<1001;j++){

           if(x[j]&&z[j-i]){
               count++;
               break;
           }

   }
   }
   cout<<count<<endl;
}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.14159265359
#define all(v) v.begin(),v.end()
int main(){
    int t;
    //cin>>t;
    t=1;
    while(t--){
   int p,q,l,r;
   cin>>p>>q>>l>>r;
   vector<int> x(1001,0);
   vector<int> z(1001,0);
   for(int i=0;i<p;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           x[j]++;
       }
   }
      for(int i=0;i<p;i++){
       int a,b;
       cin>>a>>b;
       for(int j=a;j<=b;j++){
           z[j]++;
       }
   }
 int count=0;
   for(int i=l;i<=r;i++){
       for(int j=0;j<1001;j++){
           if(i+j<1000){
           if(x[i+j]&&z[j]){
               count++;
               break;
           }
       }
   }
   }
   cout<<count<<endl;
}
}


#include <bits/stdc++.h>
#define Enigma97
using namespace std;

int main ()
{
 Enigma97
 ios_base::sync_with_stdio(0);
 cin.tie(0);
int p , q, l , r ,c=0;
cin>>p>>q>>l>>r;
map<int,int>m;
vector<pair<int,int> > v(p);
vector<pair<int,int> >vv(q);
for(int i = 0 ; i < p ; i++)
{
    cin>>v[i].first>>v[i].second;
for(int j = v[i].first;j<=v[i].second;j++)
{
    m[j]++;
}
}
for(int i = 0 ; i < q ; i++)
{
    cin>>vv[i].first>>vv[i].second;
}
for(int j = l ; j<=r ; j++)
{
    for(int i = 0 ; i < q ; i++)
    {
        if(m[vv[i].first+j]>0)
        {
            c++;
            break;
        }
          if(m[vv[i].second+j]>0)
        {
            c++;
            break;
        }
    }
}
cout<<c;
return 0 ; }


#include <bits/stdc++.h>
#define Enigma97
using namespace std;

int main ()
{
 Enigma97
int p , q, l , r ,x,y,t=0;
cin>>p>>q>>l>>r;
map<int,int>m ;
for(int i = 0 ; i < p ; i++)
{
    cin>>x>>y;
    for(int ii = x ; ii <=y ; ii++)
    {
        m[ii]++;
    }

}
vector<pair<int,int> > v(q) ;
for(int i = 0 ; i < q ; i++)
{
    cin>>v[i].first>>v[i].second;
}
for(int i = l ; i <= r ; i++)
{
    for(int j = 0 ; j < v.size() ; j++)
    {
        if(m[v[j].first+i]>0||m[v[j].second+i]>0)
        {
            t++;
            break;
        }
    }
}
cout<<t;
return 0 ; }


#include <bits/stdc++.h>
#define Enigma97
using namespace std;

int main ()
{
 Enigma97
 ios_base::sync_with_stdio(0);
 cin.tie(0);
int p , q, l , r ,c=0;
cin>>p>>q>>l>>r;
vector<pair<int,int> > v(p);
vector<pair<int,int> >vv(q);
for(int i = 0 ; i < p ; i++)
{
    cin>>v[i].first>>v[i].second;
}
for(int i = 0 ; i < q ; i++)
{
    cin>>vv[i].first>>vv[i].second;
}

for(int j = l ; j<=r ; j++)
{
    bool fg=false;
    for(int i = 0 ; i < q ; i++)
    {

       for(int k = 0 ; k < p ; k++)
       {
           if(vv[i].first+j>=v[k].first&&vv[i].first+j<=v[k].second)
           {
               c++;
               fg=true;
               break;
           }
           if(vv[i].second+j>=v[k].first&&vv[i].second+j<=v[k].second)
           {
               c++;
               fg=true;
               break;
           }
       }
       if(fg==true)
       {
           break;
       }
    }
}
cout<<c;
return 0 ; }


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
typedef long long ll;

static auto fastio = [](){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return nullptr;
}();

int main() {
    ll n;
    cin>>n;
    if(n <= 3) {
        cout<<"NO";
        return 0;
    }
    else if(n == 4){
        cout<<"YES\n";
        cout<<"4 * 3 = 12\n12 * 2 = 24";
        return 0;
    }
    else if(n == 5){
        cout<<"YES\n";
        cout<<"5 - 4 = 1\n4 - 3 = 1\n5 - 3 = 2\n2 * 4 = 8\n8 * 3 = 24";
        return 0;
    }
    else if(n > 5){
        cout<<"YES\n"<<n<<" - "<<n-1<<" = 1\n";
        cout<<1<<" * "<<24<<" = 24\n";
    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
typedef long long ll;

static auto fastio = [](){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return nullptr;
}();

int main() {
    ll n;
    cin>>n;
    if(n <= 3) {
        cout<<"NO";
        return 0;
    }
    if(n % 2 == 0){
        cout<<"YES\n";
        cout<<"1 * 2 = 2\n";
        cout<<"2 * 3 = 6\n";
        cout<<"6 * 4 = 24\n";
        for(int i = 5; i < n; i+=2){
            cout<<i+1<<" - "<<i<<" = 1 \n";
        }
        cout<<"24 * 1 = 24\n";
    } else {
        cout<<"YES\n";
        cout<<"2 - 1 = 1\n";
        cout<<"1 + 3 = 4\n";
        cout<<"4 * 5 = 20\n";
        cout<<"20 + 4 = 24\n";
        for(int i = 6; i < n; i+=2){
            cout<<i+1<<" - "<<i<<" = 1 \n";
        }
        cout<<"24 * 1 = 24\n";
    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
typedef long long ll;

static auto fastio = [](){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return nullptr;
}();

int main() {
    ll n;
    cin>>n;
    if(n <= 3) {
        cout<<"NO";
        return 0;
    }
    if(n % 2 == 0){
        cout<<"YES\n";
        cout<<"1 * 2 = 2\n";
        cout<<"2 * 3 = 6\n";
        cout<<"6 * 4 = 24\n";
        for(int i = 5; i < n; i+=2){
            cout<<i+1<<" - "<<i<<" = 1 \n";
            cout<<"24 * 1 = 24\n";
        }

    } else {
        cout<<"YES\n";
        cout<<"2 - 1 = 1\n";
        cout<<"1 + 3 = 4\n";
        cout<<"4 * 5 = 20\n";
        cout<<"20 + 4 = 24\n";
        for(int i = 6; i < n; i+=2){
            cout<<i+1<<" - "<<i<<" = 1 \n";
            cout<<"24 * 1 = 24\n";
        }
    }
    return 0;
}


#include<cstdio>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<map>
#include<iostream>
#include<math.h>
#include<memory.h>
#include<string>
#include<queue>
#include<set>
#define mod 1000000007
using namespace std;
typedef long long ll;
struct str {
	int x, y;
	bool operator < (const str& A)const {
		return x < A.x;
	}
};
str arr[300010];
str brr[300010];
int n, m, k, p,q,l,r;
int main() {
	scanf("%d", &n);
	if (n >= 4) {
		printf("YES\n");
		int cnt = 0;
		if (n % 2) {
			for (int i = n; i >= 7; i-=2) {
				printf("%d - %d = 1\n", i, i - 1);
				cnt++;
			}
			printf("4 * 5 = 20\n");
			printf("2 + 3 = 5\n");
			printf("20 + 5 = 25\n");
			printf("25 - 1 = 24\n");
		}
		else {
			for (int i = n; i >= 6; i -= 2) {
				printf("%d - %d = 1\n", i, i - 1);
				cnt++;
			}
			printf("4 * 3 = 12\n");
			printf("2 * 1 = 2\n");
			printf("12 * 2 = 24\n");
		}
		for (int i = 0; i < cnt; i++) {
			printf("24 * 1 = 24\n");
		}
	}
	else printf("NO");
	return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n == 4) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n == 5) {
		cout << "YES\n";
		cout << "5 - 3 = 2\n";
		cout << "1 + 2 = 3\n";
		cout << "3 * 2 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n == 6) {
		cout << "YES\n";
		cout << "6 - 5 = 1\n";
		cout << "1 - 1 = 0\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "24 - 0 = 24\n";
	} else if (n >= 8) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "6 - 5 = 1\n";
		cout << "8 - 7 = 1\n";
		cout << "1 - 1 = 0\n";
		for (int i = 9; i <= n; i++) {
			cout << "0 * " << i << " = " << 0 << '\n';
		}
		cout << "24 - 0 = 24\n";
	} else {
		cout << "NO\n";
	}
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n == 4) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n == 5) {
		cout << "YES\n";
		cout << "5 - 3 = 2\n";
		cout << "1 + 2 = 3\n";
		cout << "3 * 2 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n >= 6) {
		cout << "YES\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "6 - 5 = 1\n";
		cout << "1 - 1 = 0\n";
		for (int i = 7; i <= n; i++) {
			cout << "0 * " << i << " = " << 0 << '\n';
		}
		cout << "24 - 0 = 24\n";
	} else {
		cout << "NO\n";
	}
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n >= 8) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "6 - 5 = 1\n";
		cout << "8 - 7 = 1\n";
		cout << "1 - 1 = 0\n";
		for (int i = 9; i <= n; i++) {
			cout << "0 * " << i << " = " << 0 << '\n';
		}
		cout << "24 - 0 = 24\n";
	} else {
		cout << "NO\n";
	}
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n == 4) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n == 5) {
		cout << "YES\n";
		cout << "5 - 3 = 2\n";
		cout << "1 + 2 = 3\n";
		cout << "3 * 2 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n >= 8) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "6 - 5 = 1\n";
		cout << "8 - 7 = 1\n";
		cout << "1 - 1 = 0\n";
		for (int i = 9; i <= n; i++) {
			cout << "0 * " << i << " = " << 0 << '\n';
		}
		cout << "24 - 0 = 24\n";
	} else {
		cout << "NO\n";
	}
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n % 4 == 0) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		for (int i = 5; i + 1 <= n; i += 2) {
			cout << i + 1 << " - " << i << " = 1\n";
		}
		for (int i = 0; i < (n - 4) / 4; i++) {
			cout << "1 - 1 = 0\n";
		}
		for (int i = 0; i < (n - 4) / 4; i++) {
			cout << "24 - 0 = 24\n";
		}
	} else {
		cout << "NO\n";
	}
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n == 4) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n >= 8) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "6 - 5 = 1\n";
		cout << "8 - 7 = 1\n";
		cout << "1 - 1 = 0\n";
		for (int i = 9; i <= n; i++) {
			cout << "0 * " << i << " = " << 0 << '\n';
		}
		cout << "24 - 0 = 24\n";
	} else {
		cout << "NO\n";
	}
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n >= 8) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "6 - 5 = 1\n";
		cout << "8 - 7 = 1\n";
		cout << "1 - 1 = 0\n";
		for (int i = 9; i <= n; i++) {
			cout << "0 * " << i << " = " << 0 << '\n';
		}
		cout << "24 - 0 = 0\n";
	} else {
		cout << "NO\n";
	}
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	if (n == 4) {
		cout << "YES\n";
		cout << "1 * 2 = 2\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n == 5) {
		cout << "YES\n";
		cout << "5 - 3 = 2\n";
		cout << "1 + 2 = 3\n";
		cout << "3 * 2 = 6\n";
		cout << "6 * 4 = 24\n";
	} else if (n == 6) {
		cout << "YES\n";
		cout << "2 * 3 = 6\n";
		cout << "6 * 4 = 24\n";
		cout << "6 - 5 = 1\n";
		cout << "1 - 1 = 0\n";
		for (int i = 7; i <= n; i++) {
			cout << "0 * " << i << " = " << 0 << '\n';
		}
		cout << "24 - 0 = 24\n";
	} else {
		cout << "NO\n";
	}
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI1 3.14159265358979311599796346854418516159057617187500

typedef long long int ll;
ll MOD = 1e9 + 7;

ll power(ll a , ll n)
{
    unsigned long long int result=1,x=a;
    while(n>0)
    {
        if(n % 2 ==1)
            result = (result * x)%MOD;
        x = (x * x)%MOD;
        n=n/2;
    }
    return result;
}

int main()
{
    FIO
    int t;
    t=1;
    while(t--)
    {
        ll n;
        cin >> n;

        if(n<=3)
            cout << "NO" << endl;
        else if(n<=5)
        {
            if(n==4)
            {
                cout << "YES" << endl;
                cout << "1 * 2 = 2" << endl;
                cout << "2 * 3 = 6" << endl;
                cout << "6 * 4 = 24" << endl;
            }
            else
                cout << "NO" << endl;
        }
        else
        {
            cout << "YES" << endl;
            cout << "2 * 3 = 6" << endl;
            cout << "4 * 6 = 24" << endl;

            cout << "6 - 5 = 1" << endl;
            cout << "1 - 1 = 0" << endl;

            for(int i=7;i<=n;i++)
            {
                cout << "0 * " << i << " = 0" << endl;
            }
            cout << "0 + 24 = 24" << endl;

        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI1 3.14159265358979311599796346854418516159057617187500

typedef long long int ll;
ll MOD = 1e9 + 7;

ll power(ll a , ll n)
{
    unsigned long long int result=1,x=a;
    while(n>0)
    {
        if(n % 2 ==1)
            result = (result * x)%MOD;
        x = (x * x)%MOD;
        n=n/2;
    }
    return result;
}

int main()
{
    FIO
    int t;
    t=1;
    while(t--)
    {
        ll n;
        cin >> n;

        if(n<=3)
            cout << "NO" << endl;
        else if(n<=5)
        {
            if(n==4)
            {
                cout << "YES" << endl;
                cout << "1 * 2 = 2" << endl;
                cout << "2 * 3 = 6" << endl;
                cout << "6 * 4 = 24" << endl;
            }
            else
            {
                cout << "YES" << endl;
                cout << "5 - 3 = 2" << endl;
                cout << "2 * 4 = 8" << endl;
                cout << "1 + 2 = 3" << endl;
                cout << "8 * 3 = 24" << endl;
            }
        }
        else
        {
            cout << "YES" << endl;
            cout << "2 * 3 = 6" << endl;
            cout << "4 * 6 = 24" << endl;

            cout << "6 - 5 = 1" << endl;
            cout << "1 - 1 = 0" << endl;

            for(int i=7;i<=n;i++)
            {
                cout << "0 * " << i << " = 0" << endl;
            }
            cout << "0 + 24 = 24" << endl;

        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define mp make_pair
#define all(x) (x).begin(), (x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T1, typename T2>
inline bool relax(T1& a, T2 b) {
    if (a > b)
        return 1 * (a = b);
    return 0;
}

// CONSTANTS

// :::::::::::::::::::::::::::::::

void solve() {
    int n;
    cin >> n;

    if (n < 4) {
        cout << "NO";
        exit(0);
    }

    if (n % 2) {
        int sum = 3;
        for (int i = 4; i <= 5; ++i) {
            cout << sum << " + " << i << " = " << (sum + i) << '\n';
            sum += i;
        }
        cout << "12 * 2 = 24\n";
        for (int i = 6; i < n; i += 2)
            cout << (i + 1) << " - " << i << " = 1\n";
        for (int i = 0; i < n / 2 - 1; ++i)
            cout << "1 * 24 = 24\n";
    }
    else {
        int mul = 1;
        for (int i = 2; i <= 4; ++i) {
            cout << mul << " * " << i << " = " << (mul * i) << '\n';
            mul *= i;
        }

        for (int i = 5; i < n; i += 2) {
            cout << (i + 1) << " - " << i << " = 1\n1 * 24 = 24\n";
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);

    int t = 1;
//    cin >> t;
    while (t--)
        solve();

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define mp make_pair
#define all(x) (x).begin(), (x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T1, typename T2>
inline bool relax(T1& a, T2 b) {
    if (a > b)
        return 1 * (a = b);
    return 0;
}

// CONSTANTS

// :::::::::::::::::::::::::::::::

void solve() {
    int n;
    cin >> n;

    if (n < 4) {
        cout << "NO";
        exit(0);
    }
    cout << "YES\n";

    if (n % 2) {
        int sum = 3;
        for (int i = 4; i <= 5; ++i) {
            cout << sum << " + " << i << " = " << (sum + i) << '\n';
            sum += i;
        }
        cout << "12 * 2 = 24\n";
        for (int i = 6; i < n; i += 2)
            cout << (i + 1) << " - " << i << " = 1\n";
        for (int i = 0; i < n / 2 - 1; ++i)
            cout << "1 * 24 = 24\n";
    }
    else {
        int mul = 1;
        for (int i = 2; i <= 4; ++i) {
            cout << mul << " * " << i << " = " << (mul * i) << '\n';
            mul *= i;
        }

        for (int i = 5; i < n; i += 2) {
            cout << (i + 1) << " - " << i << " = 1\n1 * 24 = 24\n";
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);

    int t = 1;
//    cin >> t;
    while (t--)
        solve();

    return 0;
}


#include <fstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;

int proc(int x, int ct) {
	if(x==4||x==5) {
		if(x==4) cout << "1 * 2 = 2" << endl;
		else cout << "5 - 3 = 2\n2 + 1 = 3" << endl;
		cout << "2 * 3 = 6\n6 * 4 = 24" << endl;
		for (int i=0; i<ct; i++) cout << "24 * 1 = 24" << endl;
		return 0;
	}

	cout << x << " - " << x-1 << " = 1" << endl;
	proc(x-2,ct+1);
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	if(n<4) { cout << "NO" << endl; return 0; }
	cout << "YES" << endl;
	proc(n,0);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

int const N=5e5+10,M=1e5+1,oo=1e9;
int mod=oo+7;
ll const OO=3e18;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    if(n<4){
        cout<<"NO\n";
        return 0;
    }
    cout<<"YES\n";
    if(n%2==0){
        cout<<"4 * 3 = 12"<<endl;
        cout<<"2 * 1 = 2"<<endl;
        cout<<"12 * 2 = 24"<<endl;
    }else{
        cout<<"4 * 3 = 12"<<endl;
        cout<<"2 + 1 = 3"<<endl;
        cout<<"5 - 3 = 2"<<endl;
        cout<<"12 * 2 = 24"<<endl;
    }
    for(int i=6+(n%2);i<=n;i+=2){
        cout<<i<<" - "<<i-1<<" = "<<1<<endl;
        cout<<"24 * 1 = "<<24<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define len(a) (int)(a.size())
#define Pi acos(-1.)
#define x first
#define y second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef unsigned long long ull;
typedef long double ld;
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAXN = 1e5+5;
const int MAXM = 1e4+500;
const int N = 500 + 5;
const double EPS = 1e-9;

int dx[] = {-1,1,0,0};
int dy[] = {0,0,1,-1};
ll i,j,d;
ll n,k,m;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

   // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

    freopen("in.txt","r",stdin);
    cout << fixed;cout.precision(10);

    cin>>n;

    if(n < 4)
    {
        cout<<"NO";
        return 0;
    }

    cout<<"YES"<<endl;
    if(n == 4)
    {
        cout<<"4 * 3 = 12"<<endl<<"12 * 2 = 24"<<endl<<"24 * 1 = 24";
        return 0;
    }

    if(n%2)
    {
        int last = 0, cur = n , t = n - 5;
        t/=2;
        for(i=0;i<t;i++)
        {
            cout<<cur<<" - "<<cur-1<<" = 1"<<endl;
            cur-=2;
            last++;
        }

        cout<<"5 * 4 = 20"<<endl<<"20 + 3 = 23"<<endl<<"23 + 2 = 25"<<endl;
        cout<<"25 - 1 = 24"<<endl;

        for(i=0;i<last;i++)
            cout<<"24 * 1 = 24"<<endl;
    }else
    {

        int last = 1;
        int cur = n, t = n-4;
        t/=2;
        for(i=0;i<t;i++)
        {
            cout<<cur<<" - "<<cur-1<<" = 1"<<endl;
            cur-=2;
            last++;
        }

        cout<<"4 * 3 = 12"<<endl<<"12 * 2 = 24"<<endl;
        for(i=0;i<last;i++)
            cout<<"24 * 1 = 24"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define len(a) (int)(a.size())
#define Pi acos(-1.)
#define x first
#define y second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef unsigned long long ull;
typedef long double ld;
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAXN = 1e5+5;
const int MAXM = 1e4+500;
const int N = 500 + 5;
const double EPS = 1e-9;

int dx[] = {-1,1,0,0};
int dy[] = {0,0,1,-1};
ll i,j,d;
ll n,k,m;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin>>n;

    if(n < 4)
    {
        cout<<"NO";
        return 0;
    }
    cout<<"YES"<<endl;
    if(n == 4)
    {
        cout<<"4 * 3 = 12"<<endl<<"12 * 2 = 24"<<endl<<"24 * 1 = 24";
        return 0;
    }

    if(n%2)
    {
        int last = 0, cur = n , t = n - 5;
        t/=2;
        for(i=0;i<t;i++)
        {
            cout<<cur<<" - "<<cur-1<<" = 1"<<endl;
            cur-=2;
            last++;
        }

        cout<<"5 * 4 = 20"<<endl<<"20 + 3 = 23"<<endl<<"23 + 2 = 25"<<endl;
        cout<<"25 - 1 = 24"<<endl;

        for(i=0;i<last;i++)
            cout<<"24 * 1 = 24"<<endl;
    }else
    {

        int last = 1;
        int cur = n, t = n-4;
        t/=2;
        for(i=0;i<t;i++)
        {
            cout<<cur<<" - "<<cur-1<<" = 1"<<endl;
            cur-=2;
            last++;
        }

        cout<<"4 * 3 = 12"<<endl<<"12 * 2 = 24"<<endl;
        for(i=0;i<last;i++)
            cout<<"24 * 1 = 24"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>

#ifndef NJUDGE
  #define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const ll LINF = 0x3f3f3f3f3f3f3f3f;
const ll NLINF = 0xf7f7f7f7f7f7f7f7;
const int INF = 0x3f3f3f3f, NINF = 0xf7f7f7f7;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;

#define sz(x) (int) x.size()
#define eb emplace_back
#define pb push_back
#define ss second
#define ff first

int n;
vector <tuple<int, int, int>> sol;

int main(){
  scanf("%d", &n);
  if (n<=3) return printf("NO\n"), 0;
  if (n==4){
    printf("2 * 3 = 6\n");
    printf("6 * 4 = 24\n");
    printf("24 * 1 = 24\n");
  }
  else if (n==5){
    printf("1 + 2 = 3\n");
    printf("5 + 4 = 9\n");
    printf("3 * 9 = 27\n");
    printf("27 - 3 = 24\n");
  }
  else {
    printf("6 - 5 = 1\n");
    printf("1 - 1 = 0\n");
    for(int i = 7; i <= n; i++)
      printf("0 * %d = 0\n", i);
    printf("2 * 3 = 6\n");
    printf("6 * 4 = 24\n");
    printf("24 + 0 = 24\n");
  }
}


#include <bits/stdc++.h>

#ifndef NJUDGE
  #define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const ll LINF = 0x3f3f3f3f3f3f3f3f;
const ll NLINF = 0xf7f7f7f7f7f7f7f7;
const int INF = 0x3f3f3f3f, NINF = 0xf7f7f7f7;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;

#define sz(x) (int) x.size()
#define eb emplace_back
#define pb push_back
#define ss second
#define ff first

int n;
vector <tuple<int, int, int>> sol;

int main(){
  scanf("%d", &n);
  if (n<=3) return printf("NO\n"), 0;
  printf("YES\n");
  if (n==4){
    printf("2 * 3 = 6\n");
    printf("6 * 4 = 24\n");
    printf("24 * 1 = 24\n");
  }
  else if (n==5){
    printf("1 + 2 = 3\n");
    printf("5 + 4 = 9\n");
    printf("3 * 9 = 27\n");
    printf("27 - 3 = 24\n");
  }
  else {
    printf("6 - 5 = 1\n");
    printf("1 - 1 = 0\n");
    for(int i = 7; i <= n; i++)
      printf("0 * %d = 0\n", i);
    printf("2 * 3 = 6\n");
    printf("6 * 4 = 24\n");
    printf("24 + 0 = 24\n");
  }
}


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

//DEFINE and TYPEDEF--------------------------------------------------------------
// For actual content check from line 85

#define FORG(i,a,n) for(lld i=(lld)a;a<n?i<(lld)n:(lld)n<i;a<n?++i:--i) //for - general
#define FORZ(i,n) for(lld i=0;i<(lld)n;++i) //for - zero
#define FORGI(i,a,n,inc) for(lld i=(lld)a;a<n?i<(lld)n:(lld)n<i;a<n?i+=inc:i-=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<(lld)n;i+=inc) //for - zero incremental
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define MEM(a,val) memset(a,val,sizeof(a));

#define all(m) m.begin(),m.end()
#define sz(m) (lld)m.size()

#define st first
#define nd second
#define pb push_back
#define DEC(x) fixed<<setprecision(x)

typedef long long int lld;
typedef unsigned long long int ulld;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.st>>a.nd;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.st<<" "<<a.nd;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

//DEBUGGER------------------------------------------------------------------------
// #define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<"\n" //to debug values of variables
#define DEBUGON
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point

#ifdef DEBUGON
	vector<string> vec_splitter(string s)
	{
		for(char& c: s) c = c == ',' ?  ' ': c;
		stringstream ss; ss << s;
		vector<string> res;
		for(string z; ss >> z; res.push_back(z));
		return res;
	}

	void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx, __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
	template <typename Head, typename... Tail>
		void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T)
		{
			if(idx > 0) cerr << ", ";
			else cerr << "Line(" << LINE_NUM << "): ";
			stringstream ss; ss << H;
			cerr << args[idx] << " = " << ss.str();
			debug_out(args, idx + 1, LINE_NUM, T...);
		}

	#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__);
	#define DEBUG(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__);
#else
	#define debug(...) 320;
	#define DEBUG(...) 320;
#endif

lld power(lld b, lld e)
{
	assert(e>=0);
    if(e==0) return 1;
    if(e%2==1) return b*power(b*b,(e-1)/2);
    else return power(b*b,e/2);
}

lld power(lld b, lld e, lld m)
{
	assert(e>=0);
	if(e==0) return 1;
	if(e%2==1) return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else return power(((b%m)*(b%m))%m,e/2,m)%m;
}

#define endl '\n'
const long double pi = acos(-1);
constexpr int mod = 1e9+7; // 1000000007

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
	lld n;
	cin>>n;

	if(n==1)
		cout<<"NO\n";
	else if(n>24)
		cout<<"YES\n"<<n<<" - "<<n-24<<" = 24\n";
	else
	{
		cout<<"YES\n"<<n<<" - "<<n-1<<" = 1\n";
		FORG(i,1,25-n)
			cout<<n+i-1<<" + 1 = "<<n+i<<endl;
	}
	return;
}

int main()
{
    SPEEDUP;
 	lld tc=1;
 	//cin>>tc;

 	#ifdef PRIMES
 		sieve();
 	#endif

 	#ifdef CHOOSE
 		nCrModInit();
 	#endif

	FORZ(i,tc)
 	{
 		// cout<<"Case #"<<i+1<<": ";
 		swagWaalaFunction();
	}

	// cerr<<"\n"<<timeKyaHorhaH;
 	return 0;
}


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

//DEFINE and TYPEDEF--------------------------------------------------------------
// For actual content check from line 85

#define FORG(i,a,n) for(lld i=(lld)a;a<n?i<(lld)n:(lld)n<i;a<n?++i:--i) //for - general
#define FORZ(i,n) for(lld i=0;i<(lld)n;++i) //for - zero
#define FORGI(i,a,n,inc) for(lld i=(lld)a;a<n?i<(lld)n:(lld)n<i;a<n?i+=inc:i-=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<(lld)n;i+=inc) //for - zero incremental
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define MEM(a,val) memset(a,val,sizeof(a));

#define all(m) m.begin(),m.end()
#define sz(m) (lld)m.size()

#define st first
#define nd second
#define pb push_back
#define DEC(x) fixed<<setprecision(x)

typedef long long int lld;
typedef unsigned long long int ulld;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.st>>a.nd;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.st<<" "<<a.nd;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

//DEBUGGER------------------------------------------------------------------------
// #define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<"\n" //to debug values of variables
#define DEBUGON
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point

#ifdef DEBUGON
	vector<string> vec_splitter(string s)
	{
		for(char& c: s) c = c == ',' ?  ' ': c;
		stringstream ss; ss << s;
		vector<string> res;
		for(string z; ss >> z; res.push_back(z));
		return res;
	}

	void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx, __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
	template <typename Head, typename... Tail>
		void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T)
		{
			if(idx > 0) cerr << ", ";
			else cerr << "Line(" << LINE_NUM << "): ";
			stringstream ss; ss << H;
			cerr << args[idx] << " = " << ss.str();
			debug_out(args, idx + 1, LINE_NUM, T...);
		}

	#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__);
	#define DEBUG(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__);
#else
	#define debug(...) 320;
	#define DEBUG(...) 320;
#endif

lld power(lld b, lld e)
{
	assert(e>=0);
    if(e==0) return 1;
    if(e%2==1) return b*power(b*b,(e-1)/2);
    else return power(b*b,e/2);
}

lld power(lld b, lld e, lld m)
{
	assert(e>=0);
	if(e==0) return 1;
	if(e%2==1) return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else return power(((b%m)*(b%m))%m,e/2,m)%m;
}

#define endl '\n'
const long double pi = acos(-1);
constexpr int mod = 1e9+7; // 1000000007

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
	lld n;
	cin>>n;

	if(n<4)
		cout<<"NO\n";
	else if(n%2==0)
	{
		cout<<"YES\n";
		cout<<"1 + 2 = 3\n";
		cout<<"3 + 3 = 6\n";
		cout<<"4 * 6 = 24\n";
		FORGI(i,5,n+1,2)
		{
			cout<<i+1<<" - "<<i<<" = 1"<<endl;
			cout<<"24 * 1 = 24\n";
		}
	}
	else
	{
		cout<<"YES\n";
		cout<<"2 - 1 = 1\n";
		cout<<"4 + 5 = 9\n";
		cout<<"9 - 1 = 8\n";
		cout<<"3 * 8 = 24\n";
		FORGI(i,6,n+1,2)
		{
			cout<<i+1<<" - "<<i<<" = 1"<<endl;
			cout<<"24 * 1 = 24\n";
		}
	}
	return;
}

int main()
{
    SPEEDUP;
 	lld tc=1;
 	//cin>>tc;

 	#ifdef PRIMES
 		sieve();
 	#endif

 	#ifdef CHOOSE
 		nCrModInit();
 	#endif

	FORZ(i,tc)
 	{
 		// cout<<"Case #"<<i+1<<": ";
 		swagWaalaFunction();
	}

	// cerr<<"\n"<<timeKyaHorhaH;
 	return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back
#define PS string qqwwee;cin>>qqwwee;

int main() {
    int n;
    cin >> n;
    if(n <= 4) return cout << "NO" << endl, 0;
    cout << "YES" << endl;
    if(n == 5) {
        cout << "3 + 5 = 8\n";
        cout << "2 - 1 = 1\n";
        cout << "4 - 1 = 3\n";
        cout << "3 * 8 = 24\n";
    }
    else if(n == 6) {
        cout << "5 - 3 = 2\n";
        cout << "2 - 2 = 0\n";
        cout << "0 + 1 = 1\n";
        cout << "4 * 6 = 24\n";
        cout << "24 * 1 = 24\n";
    } else {
        if(n & 1) {
            int cnt = n - 1;
            cout << "3 + 5 = 8\n";
            cout << "2 - 1 = 1\n";
            cout << "4 - 1 = 3\n";
            cout << "3 * 8 = 24\n";
            cnt -= 4;
            for(int i=6;i<=n;i+=2) {
                cout << i+1 << " - " << i << " = 1\n";
                --cnt;
            }
            while(cnt--) cout << "1 * 24 = 24\n";
        } else {
            int cnt = n - 1;
            cout << "5 - 3 = 2\n";
            cout << "2 - 2 = 0\n";
            cout << "0 + 1 = 1\n";
            cout << "4 * 6 = 24\n";
            cout << "24 * 1 = 24\n";
            cnt -= 5;
            for(int i=7;i<=n;i+=2) {
                cout << i+1 << " - " << i << " = 1\n";
                --cnt;
            }
            while(cnt--) cout << "1 * 24 = 24\n";
        }
    }
}


#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back
#define PS string qqwwee;cin>>qqwwee;

int main() {
    int n;
    cin >> n;
    if(n <= 3) return cout << "NO" << endl, 0;
    cout << "YES" << endl;
    if(n == 4) {
        cout << "3 * 2 = 6\n";
        cout << "6 * 4 = 24\n";
        cout << "1 * 24 = 24\n";
    }
    else if(n == 5) {
        cout << "3 + 5 = 8\n";
        cout << "2 - 1 = 1\n";
        cout << "4 - 1 = 3\n";
        cout << "3 * 8 = 24\n";
    }
    else if(n == 6) {
        cout << "5 - 3 = 2\n";
        cout << "2 - 2 = 0\n";
        cout << "0 + 1 = 1\n";
        cout << "4 * 6 = 24\n";
        cout << "24 * 1 = 24\n";
    } else {
        if(n & 1) {
            int cnt = n - 1;
            cout << "3 + 5 = 8\n";
            cout << "2 - 1 = 1\n";
            cout << "4 - 1 = 3\n";
            cout << "3 * 8 = 24\n";
            cnt -= 4;
            for(int i=6;i<=n;i+=2) {
                cout << i+1 << " - " << i << " = 1\n";
                --cnt;
            }
            while(cnt--) cout << "1 * 24 = 24\n";
        } else {
            int cnt = n - 1;
            cout << "5 - 3 = 2\n";
            cout << "2 - 2 = 0\n";
            cout << "0 + 1 = 1\n";
            cout << "4 * 6 = 24\n";
            cout << "24 * 1 = 24\n";
            cnt -= 5;
            for(int i=7;i<=n;i+=2) {
                cout << i+1 << " - " << i << " = 1\n";
                --cnt;
            }
            while(cnt--) cout << "1 * 24 = 24\n";
        }
    }
}


    import operator
    from math import *
    t = int(input())
    for y in range(t):
    	n,x = map(int,input().split())
    	l = []
    	c = 0
    	for z in range(n):
    		d,h = map(int,input().split())
    		if(h >= d):
    			c += 1
    		l.append([d-h,d])
    	if(c == n):
    		print(-1)
    	else:
    		l.sort()
    		s = sorted(l, key = operator.itemgetter(1))
    		#print(s[-1],l[-1])
    		d = l[-1][0]
    		s1 = s[-1][1]
    		count = (x - s1)//d
            if((x-s)%d != 0):
                count += 1
    		print(count+1)


import operator
from math import *
t = int(input())
for y in range(t):
    n,x = map(int,input().split())
    l = []
    c = 0
    for z in range(n):
        d,h = map(int,input().split())
        if(h >= d):
            c += 1
        l.append([d-h,d])
    if(c == n):
        print(-1)
    else:
        l.sort()
        s = sorted(l, key = operator.itemgetter(1))
        #print(s[-1],l[-1])
        d = l[-1][0]
        s1 = s[-1][1]
        count = (x - s1)//d
        if((x-s1)%d != 0):
            count += 1
        print(count+1)


for i in range(int(input())):

    n,x = map(int,input().split())
    mx = 0
    mind = 1000000000000000000
    d1 = 0
    for i in range(n):
        d,h = map(int,input().split())
        if d - h > mx:
            d1 = d
            mx = d-h
    if mx == 0:
        print(-1)
        continue
    import math
    d = d1
    k = math.ceil((x-d)/mx)
    if k * mx == x:
        print(k)
    else:
        print(k+1)


for i in range(int(input())):

    n,x = map(int,input().split())
    mx = 0
    mind = 1000000000000000000
    d1 = 0
    for i in range(n):
        d,h = map(int,input().split())
        if d - h > mx:
            d1 = d
            mx = d-h
    if mx == 0:
        print(-1)
        continue
    import math
    d = d1
    k = math.ceil((x-d)/mx)
    if k * mx == x:
        print(k-1)
    else:
        print(k+1)


for i in range(int(input())):

    n,x = map(int,input().split())
    mx = 0
    mind = 1000000000000000000
    d1 = 0
    for i in range(n):
        d,h = map(int,input().split())
        if d - h > mx:

            mx = d-h
        d1 = max(d1,d)
    if mx == 0:
        print(-1)
        continue
    import math
    d = d1
    if mx <= 0:
        print(-1)
        continue
    if x <= d1:
        print(1)
        continue

    k = math.ceil((x-d)/mx) + 1

    print(k)


for i in range(int(input())):

    n,x = map(int,input().split())
    mx = 0
    mind = 1000000000000000000
    d1 = 0
    for i in range(n):
        d,h = map(int,input().split())
        if d - h > mx:

            mx = d-h
        d1 = max(d1,d)

    import math
    d = d1

    if x <= d1:
        print(1)
        continue
    if mx <= 0:
        print(-1)
        continue

    k = math.ceil((x-d)/mx) + 1

    print(k)


from math import ceil
t = int(input())
for i in range(t):
    n, x = map(int, input().split())
    a = []
    max_p = 0
    for j in range(n):
        p, q = map(int, input().split())
        max_p = max(p, max_p)
        a.append((p, q))
    a.sort(key=lambda y: y[0] - y[1], reverse=True)
    min_k = 10 ** 9 + 1
    if max_p >= x:
        min_k = 1
    else:
        for item in a:
            d = item[0] - item[1]
            if d > 0:
                min_k = min(ceil((x - max_p) / d) + 1, min_k)
    if min_k == 10 ** 9 + 1:
        print(-1)
    else:
        print(min_k)


from math import ceil
t = int(input())
for i in range(t):
    n, x = map(int, input().split())
    a = []
    max_p = 0
    for j in range(n):
        p, q = map(int, input().split())
        max_p = max(p, max_p)
        a.append((p, q))
    a.sort(key=lambda y: y[0] - y[1], reverse=True)
    min_k = 10 ** 9 + 1
    if max_p >= x:
        min_k = 1
    for item in a:
        d = item[0] - item[1]
        if d > 0:
            min_k = min(ceil((x - max_p) / d) + 1, min_k)
    if min_k == 10 ** 9 + 1:
        print(-1)
    else:
        print(min_k)


from math import ceil
t = int(input())
for i in range(t):
    n, x = map(int, input().split())
    a = []
    k = 0
    for j in range(n):
        p, q = map(int, input().split())
        a.append((p, q))
    a.sort(key=lambda y: y[0] - y[1], reverse=True)
    if a[0][0] >= x:
        k += 1
    else:
        d = a[0][0] - a[0][1]
        if d <= 0:
            k -= 1
        else:
            k += ceil((x - a[0][0]) / d) + 1
    print(k)


from math import ceil
t = int(input())
for _ in range(t):
    n, x = [int(x) for x in input().split()]
    blows = []
    for _ in range(n):
        d, h = [int(x) for x in input().split()]
        blows.append((d, h))

    blows.sort(key=lambda x:x[0]-x[1])
    eff = blows[-1]
    blows.sort(key=lambda x:x[0])
    mhit = blows[-1]

    if (eff[0] - eff[1] <= 0):
        print(-1)
    else:
        if (x <= mhit[0]):
            print(1)
        else:
            print(ceil((x - mhit[0]) / (eff[0] - eff[1])) + 1)


from math import ceil
t = int(input())
for _ in range(t):
    n, x = [int(x) for x in input().split()]
    blows = []
    for _ in range(n):
        d, h = [int(x) for x in input().split()]
        blows.append((d, h))

    blows.sort(key=lambda x:x[0]-x[1])
    eff = blows[-1]
    blows.sort(key=lambda x:x[0])
    mhit = blows[-1]

    if (x <= mhit[0]):
        print(1)
    elif (eff[0] - eff[1] <= 0):
        print(-1)
    else:
        print(ceil((x - mhit[0]) / (eff[0] - eff[1])) + 1)


import math
t=int(input())
for w in range(t):
    n,x=(int(i) for i in input().split())
    diff=[]
    d=[]
    h=[]
    c=0
    for i in range(n):
        di,hi=(int(i) for i in input().split())
        if(di<=hi):
            c+=1
        d.append(di)
        h.append(hi)
        diff.append(di-hi)
    m=diff[0]
    m1=d[0]
    m2=h[0]
    for i in range(n):
        m=max(diff[i],m)
        if(m==diff[i]):
            m1=d[i]
            m2=h[i]
    m3=max(d)
    if(c==n):
        if(m3>=x):
            print(1)
        else:
            print(-1)
    else:
        k=max(0,math.ceil((x-m3)/m))
        print(max(1,k+1))


import math
t=int(input())
for w in range(t):
    n,x=(int(i) for i in input().split())
    diff=[]
    d=[]
    h=[]
    c=0
    for i in range(n):
        di,hi=(int(i) for i in input().split())
        if(di<=hi):
            c+=1
        d.append(di)
        h.append(hi)
        diff.append(di-hi)
    m=diff[0]
    m1=d[0]
    m2=h[0]
    for i in range(n):
        m=max(diff[i],m)
        if(m==diff[i]):
            m1=d[i]
            m2=h[i]
    if(c==n):
        print(-1)
    else:
        k=math.ceil(x/m)
        c=max(0,k-2)
        x-=c*m
        while(x>0):
            c+=1
            x-=m1
            if(x<=0):
                break
            x+=m2
        print(c)


import math
t=int(input())
for w in range(t):
    n,x=(int(i) for i in input().split())
    diff=[]
    d=[]
    h=[]
    c=0
    for i in range(n):
        di,hi=(int(i) for i in input().split())
        if(di<=hi):
            c+=1
        d.append(di)
        h.append(hi)
        diff.append(di-hi)
    m=diff[0]
    m1=d[0]
    m2=h[0]
    for i in range(n):
        m=max(diff[i],m)
        if(m==diff[i]):
            m1=d[i]
            m2=h[i]
    m3=max(d)
    if(c==n):
        print(-1)
    else:
        k=math.ceil((x-m3)/m)
        print(k+1)


import math
t=int(input())
for w in range(t):
    n,x=(int(i) for i in input().split())
    diff=[]
    d=[]
    h=[]
    c=0
    for i in range(n):
        di,hi=(int(i) for i in input().split())
        if(di<=hi):
            c+=1
        d.append(di)
        h.append(hi)
        diff.append(di-hi)
    m=diff[0]
    m1=d[0]
    m2=h[0]
    for i in range(n):
        m=max(diff[i],m)
        if(m==diff[i]):
            m1=d[i]
            m2=h[i]
    m3=max(d)
    if(c==n):
        if(m3>=x):
            print(1)
        else:
            print(-1)
    else:
        k=max(0,math.ceil((x-m3)/m))
        print(k+1)


import math
t=int(input())
for w in range(t):
    n,x=(int(i) for i in input().split())
    diff=[]
    d=[]
    h=[]
    c=0
    for i in range(n):
        di,hi=(int(i) for i in input().split())
        if(di<=hi):
            c+=1
        d.append(di)
        h.append(hi)
        diff.append(di-hi)
    m=diff[0]
    m1=d[0]
    m2=h[0]
    for i in range(n):
        m=max(diff[i],m)
        if(m==diff[i]):
            m1=d[i]
            m2=h[i]
    m3=max(d)
    if(c==n):
        print(-1)
    else:
        k=math.ceil((x-m3)/m)
        print(max(1,k+1))


for _ in range(int(input())):
	n, x = map(int, input().split())
	q = [[*map(int, input().split())] for _ in range(n)]
	q.sort(key=lambda x: -(x[0] - x[1]))
	m = max(i[0] for i in q)

	t = (q[0][0] - q[0][1])
	print(-1 if m >= x or t < 0 else max(-1, 1 + ((x - m) + t - 1) // t))


for _ in range(int(input())):
	n, x = map(int, input().split())
	q = [[*map(int, input().split())] for _ in range(n)]
	q.sort(key=lambda x: -(x[0] - x[1]))
	m = max(i[0] for i in q)

	t = (q[0][0] - q[0][1])
	print(1 if m >= x else -1 if t <= 0 else max(-1, 1 + ((x - m) + t - 1) // t))


for _ in range(int(input())):
	n, x = map(int, input().split())
	q = [[*map(int, input().split())] for _ in range(n)]
	q.sort(key=lambda x: -(x[0] - x[1]))
	m = max(i[0] for i in q)

	t = (q[0][0] - q[0][1])
	print(1 if m >= x else -1 if t < 0 else max(-1, 1 + ((x - m) + t - 1) // t))


import math
import sys
def main():
    t=int(input())
    for test in range(t):
        n,x=sys.stdin.readline().split()
        n=int(n)
        x=int(x)
        arr=[]
        for i in range(n):
            l=[int(i)for i in sys.stdin.readline().split()]
            arr.append(l)
        sys.stdout.write(str((math.ceil(count(n,x,arr)))))
        sys.stdout.write("\n")
def count(n,x,arr):
    l=[]
    r=[]
    for i in range(n):
        l.append(arr[i][0])
        r.append(arr[i][0]-arr[i][1])
    lm=max(l)
    rm=max(r)
    if lm>=x:
        return 1
    if rm<=0:
        return -1
    else:
        new=(x-lm)/rm
        if new<1:
            return 2
        return new+1
if __name__ == "__main__":
    main()


import math
def main():
    t=int(input())
    for test in range(t):
        n,x=input().split()
        n=int(n)
        x=int(x)
        arr=[]
        for i in range(n):
            l=[int(i)for i in input().split()]
            arr.append(l)
        print(math.ceil(count(n,x,arr)))
def count(n,x,arr):
    l=[]
    r=[]
    for i in range(n):
        l.append(arr[i][0])
        r.append(arr[i][0]-arr[i][1])
    lm=max(l)
    rm=max(r)
    if lm>=x:
        return 1
    if rm<0:
        return -1
    else:
        new=(x-lm)/rm
        if new<1:
            return 2
        return new+1
if __name__ == "__main__":
    main()


def main():
    t=int(input())
    for test in range(t):
        n,x=input().split()
        n=int(n)
        x=int(x)
        arr=[]
        for i in range(n):
            l=[int(i)for i in input().split()]
            arr.append(l)
        print(int(count(n,x,arr)))
def count(n,x,arr):
    l=[]
    r=[]
    for i in range(n):
        l.append(arr[i][0])
        r.append(arr[i][0]-arr[i][1])
    lm=max(l)
    rm=max(r)
    if lm>=x:
        return 1
    if rm<0:
        return -1
    else:
        new=(x-lm)/rm
        if new<1:
            return 2
        return new+1
if __name__ == "__main__":
    main()


import sys
input = sys.stdin.readline

t=int(input())
for ll in range(t):
    n, x=map(int, input().split())
    m=0
    ma=0
    for i in range(n):
        d, h=map(int, input().split())
        ma=max(d, ma)
        if ma>=x: print(1); break
        m=max(m, d-h)
    else:
        if m>0:
            print((x-ma+m-1)//m +1)
        else:
            print(-1)


import sys
input = sys.stdin.readline

t=int(input())
for ll in range(t):
    n, x=map(int, input().split())
    m=0
    ma=0
    z=0
    for i in range(n):
        d, h=map(int, input().split())
        ma=max(d, ma)
        if ma>=x and z==0: print(1); z=1
        m=max(m, d-h)
    else:
        if z==0:
            if m>0:
                print((x-ma+m-1)//m +1)
            else:
                print(-1)


import sys
input = sys.stdin.readline

t=int(input())
for ll in range(t):
    n, x=map(int, input().split())
    m=0
    ma=0
    z=0
    for i in range(n):
        d, h=map(int, input().split())
        ma=max(d, ma)
        if ma>=x: print(1); z=1
        m=max(m, d-h)
    else:
        if z==0:
            if m>0:
                print((x-ma+m-1)//m +1)
            else:
                print(-1)


t=int(input())
for _ in range(t):
    n, x=map(int,input().split())
    z=10*9
    f=0
    for i in range(n):
        d, h =map(int, input().split())
        if h-d>=0:
            if i==n-1 and f==0:
                print(-1)
            elif d>=x and i==n-1:
                print(min(1 , z))
            elif f==1 and i==n-1:
                print(z)
        else:
            f=1
            k=x%(d-h)
            if k>1:
                k=1
            else: k=0
            z=min(z, x//(d-h)+k)
            if i==n-1: print(z)


ii=lambda:int(input())
kk=lambda:map(int,input().split())
ll=lambda:list(kk())
for _ in range(ii()):
	n,x = kk()
	maxd=maxi=0
	for _ in range(n):
		a,b=kk()
		if a> maxi: maxi=a
		if a-b>maxd:maxd=a-b
	x-=maxi
	if x <=0:
		print(1)
	elif maxd==0:
		print(-1)
	else:
		print(1+(x//maxd)+min(1, x%maxd))


ii=lambda:int(input())
kk=lambda:map(int,input().split())
ll=lambda:list(kk())
for _ in range(ii()):
	n,x = kk()
	maxd=maxi=0
	for _ in range(n):
		a,b=kk()
		if a> maxi: maxi=a
		if a-b>maxd:maxd=a-b
	x-=maxi
	if maxd==0 and x > 0:
		print(-1)
		continue
	print(1+(x//maxd)+min(1, x%maxd))


#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=998244353
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
# vsInput()

for _ in range(Int()):
    n,x=value()
    ans=inf
    max_d=0
    a=[]

    for i in range(n):
        d,h=value()
        max_d=max(d,max_d)
        a.append((d,h))

    x-=max_d
    if(x<=0):
        ans=1

    for i in range(n):
        d,h=a[i]

        cur_ans=inf

        if(d>h and x>0):
            effect=d-h
            cur_ans=ceil(x/effect)

        ans=min(cur_ans+1,ans)
        # print(d,h,cur_ans)

    if(ans==inf):ans=-1

    print(ans)


#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=998244353
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
# vsInput()

for _ in range(Int()):
    n,x=value()
    ans=inf

    for i in range(n):
        d,h=value()

        cur_ans=inf

        if(d>h):
            effect=d-h
            mod=x%effect

            if(mod+effect<=d):
                cur_ans=x//effect
            else:
                cur_ans=x//effect+1
        elif(d>=x):
            cur_ans=1

        ans=min(cur_ans,ans)

    if(ans==inf):ans=-1

    print(ans)