#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define rep2(i, a)for(auto i : a)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll mod = 998244353;
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll co(ll n, ll k) { ll a = 1; rep(i, 1ll, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
ll modinv(ll a) { ll b = mod, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }u %= mod; if (u < 0) u += mod; return u; }

int main() {
	int n, m;
	cin >> n >> m;
	vector<ll> h(n), w(m);
	rep(i, 0, n)cin >> h[i];
	rep(i, 0, m)cin >> w[i];
	sort(all(h));
	sort(all(w));
	ll ans = 1ll << 60;
	ll t = 0;
	for (int i = 0; i < n; i += 2) {
		auto it = lower_bound(all(w), h[i]);
		ll w1 = 1ll << 60, w2 = 1ll << 60;
		if (it != w.begin())w1 = *(it - 1);
		if (it != w.end())w2 = *it;
		ll temp = min(abs(h[i] - w1), abs(h[i] - w2));
		t += temp;
		if (i == 0) {
			for (int j = 1; j < n; j += 2) {
				t += h[j + 1] - h[j];
			}
		}
		else {
			t -= h[i] - h[i - 1];
			t += h[i - 1] - h[i - 2];
		}
		ans = min(ans, t);
		t -= temp;
	}
	printf("%lld\n", ans);
	return 0;
}
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i))
#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;

const int INF = 1001001001;

auto solve(int64_t A, int64_t B, int64_t W) {
    // TODO: edit here
    W *= 1000;

    int l = 0, r = 0, ans_min = INF, ans_max = -1, cnt = 0;
    while (1) {
        cnt++;
        l += A;
        r += B;
        if (l <= W && W <= r) {
            ans_min = min(ans_min, cnt);
            ans_max = max(ans_max, cnt);
        }
        if (W < l) break;
    }

    if (ans_min == INF && ans_max == -1) {
        cout << "UNSATISFIABLE" << endl;
        exit(0);
    }

    vector<int> ans = {ans_min, ans_max};
    return ans;
}

// generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    constexpr char endl = '\n';
    int64_t A, B, W;
    cin >> A >> B >> W;
    auto ans = solve(A, B, W);
    REP (i, 2) { cout << ans[i] << endl; }
    cout << endl;
    return 0;
}
