import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

void main() {
    long A, B;
    int K;

    readf("%d %d %d", &A, &B, &K);

    char[] x = format("%09d", A).dup.reverse;
    char[] y = format("%09d", B).dup.reverse;
    //writeln([x, y]);
    long ans = 0;
    void calc(int i, int[] borrow, char[] ret, int k) {
        if (i == 9) {
            auto s = ret.dup;
            s.reverse;
            ans = max(ans, s.to!long);
            return;
        }
        int c = cast(int)(x[i] - '0'),
            d = cast(int)(y[i] - '0');
        if (borrow[i] && k < K) {
            if (c >= d) {
                calc(i + 1, borrow, ret ~ (c - d).to!string, k + 1);
            } else {
                borrow[i + 1] = 1;
                calc(i + 1, borrow, ret ~ (10 + c - d).to!string, k + 1);
            }
        }
        if (c - borrow[i] >= d) {
            ret ~= (c - d - borrow[i]).to!string;
            calc(i + 1, borrow, ret, k);
        } else {
            borrow[i + 1] = 1;
            ret ~= (10 + c - d - borrow[i]).to!string;
            calc(i + 1, borrow, ret, k);
        }
    }

    calc(0, new int[9], new char[0], 0);
    writeln(ans);

}