Minimal number of generators of a direct sum Let $R$ be a ring, $M$ be a finitely generated $R$-module. Let us define $e(M)$ to be the minimal of number of generators of $M$. Clearly, for finitely generated $R$-modules $M,N$ we have
$\mathrm{max}(e(M),e(N)) \leq e(M \oplus N) \leq e(M) + e(N).$
Question A. Are there better bounds, or is every value in between possible for $e(M \oplus N)$?
For example there are rings $R \neq 0$ such that $R \oplus R \cong R$ as $R$-modules, so that $e(R \oplus R)=1$. But for a commutative ring $R \neq 0$, we have $e(R \oplus R)=2$. The following question is more interesting for me:
Question B. Let $R$ be commutative ring, having only trivial idempotents (see the comment by navigetor23). Does it follow that $e(M \oplus N) = e(M) + e(N)$?
If this turns out to be false, which additional conditions should be imposed on $R$? For example, it should suffice that $R$ is a PID, right? But this is quite strong. 
 A: Question B has obviously positive answer if $R$ is local. But otherwise it is far from to be true. 
Suppose we have (or rather $R$ has) two distinct maximal ideals $\mathfrak m$ and $\mathfrak n$. Let $m\le n$ be positive integers. Let $M=(R/\mathfrak m)^m$ and $N=(R/\mathfrak n)^n$. Then by Chinese Remainder Theorem, 
$$ R^n\to (R/\mathfrak m)^n\oplus (R/\mathfrak n)^n \to M\oplus N $$
are surjective. Therefore $e(M\oplus N)=n$ and $e(M)+e(N)=m+n$. 
I think that playing with similar construction, everything between the max and the sum should happen for $e(M\oplus N)$. 
Edit The above example uses in fact local computations of $e$. Here is an example of different taste. Let $R$ be a non-principal Dedekind domaine, let $L$ be finitely generated projective module over $R$ of rank $\ell$. Then it is known that $L$ can be generated by $\ell+1$ elements (let $a\in R$ be non-zero. Then $L/aL$ is locally free over the semi-local ring $R/aR$, so it is free of rank $\ell$. Lift a basis to $L$ and add $a$ to form a system of generators). If $L$ is not free then $e(L)=\ell+1$. As $R$ is non principal, there is a non principal ideal $I$. So $e(I)=2$. But the above discussions, 
$$e(I\oplus I)\le 3<e(I)+e(I).$$  
