Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long n, m;
- int a, b;
- scanf("%lld %lld %d %d", &n, &m, &a, &b);
- if(a * (m - (n % m)) > b * (n % m)) printf("%lld\n", b * (n % m));
- else printf("%lld\n", a * (m - (n % m)));
- }
Advertisement
Add Comment
Please, Sign In to add comment