# Distribute function over one argument

I have a function (say $$f$$) which takes two arguments. The first argument will either be an integer or a linear combination of f's, and the second argument will always be an integer. If we do have the former case i.e. a linear combination of f's, then those f's themselves just have integers as arguments.

So the first case would look like e.g. $$f[2,3]$$ while the second case would look like e.g. $$f[f[1,4] + 2f[3,7] - 6f[5,2], 3]$$.

There may be many terms in the sum in the first argument. In the 'linear combination of f's' case, I want to distribute this over the first argument while pulling out any constants, so e.g. the relevant case above should simplify to $$f[f[1,4],3] + 2f[f[3,7],3] - 6f[f[5,2], 3]$$.

I'd be very grateful for advice on a sensible solution to this!

ClearAll[f];