#include <stdio.h>
#include <stdlib.h>

int main(void){
    long long N, K, x;

    scanf("%lld%lld", &N, &K);
    x = N;
    printf("%lld %lld %lld\n", N, K, x);

    if(x > K)
        x %= K;
    if(x > K/2)
        x = K - x;

    printf("%lld\n", x);

    return 0;
}