# using Apply to get iterated Sum

Suppose I want to sum a function, $$f(\{m_a\})$$, of several variables, $$m_a$$, $$a=1,..,n$$, which run over ranges, $$1,...,k[[a]]$$, however, I do not know $$n$$ in advance. I thought I could do this using Apply,'' namely:

Apply[Sum,Join[{f[Table[Subscript[m,a],{a,1,n}]]},Table[{Subscript[m,a],1,k[[a]]},{a,1,n}]]]


However, I'm running into the following problem. The function $$f$$ is getting called only once, at the argument $$\{m_a\}$$'', ie, before assigning them the numerical values being summed over. If the function requires numerical inputs, this won't run properly. However, if I write the corresponding Sum by hand (ie, in cases where I know in advance what $$n$$ is), then $$f$$ is called for each term in the sum, and there is no problem. How can I make this sum behave as I'd like for arbitrary $$n$$?

Sum[f[Table[Subscript[m,a],{a,1,n}]],Evaluate[Sequence@@Table[{Subscript[m,a],1,k[[a]]},{a,1,n}]]]