if __name__ == "__main__":
    X, K, D = map(lambda x: abs(int(x)), input().split())

    if X - K*D >= 0:
        print(X - K*D)
    else:
        xdd = X // D
        k = xdd + (K - xdd) % 2
        print(abs(X - k*D)) if __name__ == "__main__":
    X, K, D = map(lambda x: abs(int(x)), input().split())

    if X - K*D >= 0:
        print(X - K*D)
    else:
        xdd = X // D
        k = xdd + (K - xdd) % 2
        print(abs(X - k*D)) __name__ == "__main__" __name__ "__main__" X, K, D = map(lambda x: abs(int(x)), input().split()) X map(lambda x: abs(int(x)), input().split()) map lambda x: abs(int(x)) abs(int(x)) abs int(x) int x x input().split() ().split () input split K D if X - K*D >= 0:
        print(X - K*D)
    else:
        xdd = X // D
        k = xdd + (K - xdd) % 2
        print(abs(X - k*D)) X - K*D >= 0 X - K*D X K*D K D 0 print(X - K*D) print X - K*D X K*D K D xdd = X // D xdd X // D X D k = xdd + (K - xdd) % 2 k xdd + (K - xdd) % 2 xdd (K - xdd) % 2 K - xdd K xdd 2 print(abs(X - k*D)) print abs(X - k*D) abs X - k*D X k*D k D k = xdd + (K - xdd) % 2 xdd + (K - xdd) % 2 k X, K, D = map(lambda x: abs(int(x)), input().split()) map(lambda x: abs(int(x)), input().split()) X xdd = X // D X // D xdd K, D = map(lambda x: abs(int(x)), input().split()) map(lambda x: abs(int(x)), input().split()) K D = map(lambda x: abs(int(x)), input().split()) map(lambda x: abs(int(x)), input().split()) D
if __name__ == "__main__":
    X, K, D = map(lambda x: abs(int(x)), input().split())

    if X - K*D >= 0:
        print(X - K*D)
    else:
        xdd = X // D
        k = xdd + (K - xdd) % 2
        print(abs(X - k*D))
