def main():
    in_list = list(map(int, input().split()))
    X = abs(in_list[0])
    K = in_list[1]
    D = in_list[2]

    max_move = K*D
    if max_move < X:
        print(X-max_move)
    else:
        iter1 = int(X/D)+1
        iter2 = K - iter1
        ans = X - iter1*D
        if iter2%2 == 0:
            print(abs(ans))
        else:
            print(abs(ans+D))

if __name__ == "__main__":
    main() def main():
    in_list = list(map(int, input().split()))
    X = abs(in_list[0])
    K = in_list[1]
    D = in_list[2]

    max_move = K*D
    if max_move < X:
        print(X-max_move)
    else:
        iter1 = int(X/D)+1
        iter2 = K - iter1
        ans = X - iter1*D
        if iter2%2 == 0:
            print(abs(ans))
        else:
            print(abs(ans+D)) main in_list = list(map(int, input().split())) in_list list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split X = abs(in_list[0]) X abs(in_list[0]) abs in_list[0] in_list 0 K = in_list[1] K in_list[1] in_list 1 D = in_list[2] D in_list[2] in_list 2 max_move = K*D max_move K*D K D if max_move < X:
        print(X-max_move)
    else:
        iter1 = int(X/D)+1
        iter2 = K - iter1
        ans = X - iter1*D
        if iter2%2 == 0:
            print(abs(ans))
        else:
            print(abs(ans+D)) max_move < X max_move X print(X-max_move) print X-max_move X max_move iter1 = int(X/D)+1 iter1 int(X/D)+1 int(X/D) int X/D X D 1 iter2 = K - iter1 iter2 K - iter1 K iter1 ans = X - iter1*D ans X - iter1*D X iter1*D iter1 D if iter2%2 == 0:
            print(abs(ans))
        else:
            print(abs(ans+D)) iter2%2 == 0 iter2%2 iter2 2 0 print(abs(ans)) print abs(ans) abs ans print(abs(ans+D)) print abs(ans+D) abs ans+D ans D if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    in_list = list(map(int, input().split()))
    X = abs(in_list[0])
    K = in_list[1]
    D = in_list[2]

    max_move = K*D
    if max_move < X:
        print(X-max_move)
    else:
        iter1 = int(X/D)+1
        iter2 = K - iter1
        ans = X - iter1*D
        if iter2%2 == 0:
            print(abs(ans))
        else:
            print(abs(ans+D)) def main():
    in_list = list(map(int, input().split()))
    X = abs(in_list[0])
    K = in_list[1]
    D = in_list[2]

    max_move = K*D
    if max_move < X:
        print(X-max_move)
    else:
        iter1 = int(X/D)+1
        iter2 = K - iter1
        ans = X - iter1*D
        if iter2%2 == 0:
            print(abs(ans))
        else:
            print(abs(ans+D)) main
def main():
    in_list = list(map(int, input().split()))
    X = abs(in_list[0])
    K = in_list[1]
    D = in_list[2]

    max_move = K*D
    if max_move < X:
        print(X-max_move)
    else:
        iter1 = int(X/D)+1
        iter2 = K - iter1
        ans = X - iter1*D
        if iter2%2 == 0:
            print(abs(ans))
        else:
            print(abs(ans+D))

if __name__ == "__main__":
    main()