#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(), a.end()
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define fb(i,b,a) for(int i=b;i>=a;i--)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 200005;
const ll inf = 1e18 + 5;

int n, m;

ll a[maxn];
ll b[maxn];

ll pref[maxn];
ll sufi[maxn];

int main()
{
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
    cin >> n >> m;
    ff(i,1,n)cin >> a[i];
    ff(i,1,m)cin >> b[i];
    sort(a + 1, a + n + 1);
//    cout << endl;
//    ff(i,1,n)cout << a[i] << " ";
//    cout << endl;
//    cout << endl;
    ff(i,1,n)pref[i] = pref[i - 1] + (i % 2 == 1 ? -a[i] : a[i]);
    fb(i,n,1)sufi[i] = sufi[i + 1] + (i % 2 == 1 ? a[i] : -a[i]);
//    ff(i,1,n)cout << pref[i] << " ";
//    cout << endl;
//    ff(i,1,n)cout << sufi[i] << " ";
//    cout << endl;
    ll rez = inf;
    ff(i,1,m){
        ll x = b[i];
        int l = 1, r = n, ans = 0;
        while(l <= r){
            int mid = (l + r) / 2;
            if(a[mid] <= x){
                ans = mid;
                l = mid + 1;
            }
            else r = mid - 1;
        }
//        cout << "ans: " << ans << endl;
        ans += (ans % 2 == 0);
        ll kol = pref[ans - 1] + abs(x - a[ans]) + sufi[ans + 1];
//        cout << "kol: " << kol << endl;
        rez = min(rez, kol);
    }
    cout << rez << endl;
    return 0;
}
/**



// probati bojenje sahovski ili slicno

**/



#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#define debug(...) fprintf(stderr, __VA_ARGS__);
#define rep(i, j, k) for(int i = j; i <= k; ++ i)
#define per(i, j, k) for(int i = j; i >= k; -- i)
using namespace std;

#define fs first
#define sc second
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;

const int N = 4e5 + 10;
const int mod = 1e9 + 7;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 Rand(seed);
uniform_int_distribution<ll> ran(0, 1ll << 62);
void ucin() {
  ios::sync_with_stdio(0); cin.tie(0);
}
// uniform_real_distribution<double> dbran;
template<class T> inline void chkmax(T &x, const T &y) { if(x < y) x = y; }
template<class T> inline void chkmin(T &x, const T &y) { if(x > y) x = y; }

inline ll sqr(ll x) { return x * x; }
inline ll cub(ll x) { return x * x * x; }

int main() {
  ucin();
  int n, s, d, ans = 0;
  cin >> n >> s >> d;
  rep(i, 1, n) {
    int x, y;
    cin >> x >> y;
    if(x < s && y > d) {
      ans = 1;
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}