
// #pragma GCC optmize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;

template <typename T>
void sort(T &s) {
    sort(all(s));
}

template<typename T>
void rsort(T &s) {
    sort(rall(s));
}

const int inf = 2e9 + 2000;
const ll infll = 2e18 + 2000;
const int R = (1 << 20);
mt19937 rnd(26);

template <typename T>
struct point {
    T x, y;
    point(T x, T y) : x(x), y(y) {}
    point(point a, point b) : x(b.x - a.x), y(b.y - a.y) {}

    point operator + (point &o) const {
        return {x + o.x, y + o.y};
    }

    point operator * (const T k) const {
        return {x * k, y * k};
    }

    T operator * (const point &o) const {
        return x * o.x + y * o.y;
    }

    T operator % (const point &o) const {
        return x * o.y - y * o.x;
    }

    T len2() {
        return x * x + y * y;
    }

    ld len() {
        return sqrt(x * x + y * y);
    }
};




void solve() {
    int n, m, g;
    cin >> n >> m >> g;

    if (g == 3 || g == 4) {
        cout << m - n + 1;
    }
}


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

    int tt = 1;
    // cin >> tt;

    while (tt--) {
        solve();
    }
}
