#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

string A, B;
int K, ans;
int to_int(char ch) { return ch - '0'; }
void dfs(int pos, int down, int cnt, string result)
{
    if(pos >= A.size())
    {
        reverse(result.begin(), result.end());
        ans = max(ans, stoi(result));
        return;
    }
    int c = to_int(A[pos]) - down - to_int(B[pos]);
    if(c >= 0)
    {
        result += to_string(c);
        dfs(pos + 1, 0, cnt, result);
    }
    else
    {
        result += to_string(c + 10);
        if(cnt > 0) dfs(pos + 1, 0, cnt - 1, result);
        dfs(pos + 1, 1, cnt, result);
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ans = 0;
    cin >> A >> B >> K;
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
    while(A.size() != B.size()) B += '0';
    dfs(0, 0, K, "");
    cout << ans << endl;
    return 0;
}
