def main():
    x, k, d = map(int,input().split())
    abs_x = abs(x)
    times = abs_x // d
    if(times > k):
        print(abs_x - k * d)
    else:
        if((k - times) % 2 == 0):
            print(abs_x - times * d)
        else:
            print(abs(abs_x - (times + 1) * d))
if __name__ == '__main__':
    main() def main():
    x, k, d = map(int,input().split())
    abs_x = abs(x)
    times = abs_x // d
    if(times > k):
        print(abs_x - k * d)
    else:
        if((k - times) % 2 == 0):
            print(abs_x - times * d)
        else:
            print(abs(abs_x - (times + 1) * d)) main x, k, d = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d abs_x = abs(x) abs_x abs(x) abs x times = abs_x // d times abs_x // d abs_x d if(times > k):
        print(abs_x - k * d)
    else:
        if((k - times) % 2 == 0):
            print(abs_x - times * d)
        else:
            print(abs(abs_x - (times + 1) * d)) times > k times k print(abs_x - k * d) print abs_x - k * d abs_x k * d k d if((k - times) % 2 == 0):
            print(abs_x - times * d)
        else:
            print(abs(abs_x - (times + 1) * d)) (k - times) % 2 == 0 (k - times) % 2 k - times k times 2 0 print(abs_x - times * d) print abs_x - times * d abs_x times * d times d print(abs(abs_x - (times + 1) * d)) print abs(abs_x - (times + 1) * d) abs abs_x - (times + 1) * d abs_x (times + 1) * d times + 1 times 1 d if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    x, k, d = map(int,input().split())
    abs_x = abs(x)
    times = abs_x // d
    if(times > k):
        print(abs_x - k * d)
    else:
        if((k - times) % 2 == 0):
            print(abs_x - times * d)
        else:
            print(abs(abs_x - (times + 1) * d)) def main():
    x, k, d = map(int,input().split())
    abs_x = abs(x)
    times = abs_x // d
    if(times > k):
        print(abs_x - k * d)
    else:
        if((k - times) % 2 == 0):
            print(abs_x - times * d)
        else:
            print(abs(abs_x - (times + 1) * d)) main
def main():
    x, k, d = map(int,input().split())
    abs_x = abs(x)
    times = abs_x // d
    if(times > k):
        print(abs_x - k * d)
    else:
        if((k - times) % 2 == 0):
            print(abs_x - times * d)
        else:
            print(abs(abs_x - (times + 1) * d))
if __name__ == '__main__':
    main()