Not able to get the intuition

Here i am solving this question from codeforces…
https://codeforces.com/problemset/problem/1245/A
I am not able to get the real idea… even after watching the editorial.
Could you explain a bit??

hello @ashishnnnnn
bro learn about linear diophantine equation and then attempt this problem

Okay… I am searching it on net …

@ashishnnnnn
also check this theorem->
https://artofproblemsolving.com/wiki/index.php/Chicken_McNugget_Theorem