Does the ring of integers have the following property? As a follow-up to this question, I'd like to ask:
What are examples of rings $R$ with the property that for all finite sets of ideals $I_1,\ldots,I_n$ in $R$ the sequence
$$
\bigoplus_{1\leq j < k\leq n}^n I_j\cap I_k\quad\xrightarrow{f}\quad\bigoplus_{l=1}^n I_l\quad\xrightarrow{g}\quad\sum_{k=1}^n I_k
$$
is exact in the middle? Here $g$ is given by addition, and $f$ maps $x\in I_j\cap I_k$ to $x\in I_j$ and to $-x\in I_k$ (and to zero in all other components).
A complete description of this class of rings would be even better, of course.
Obvious examples seem to be rings with at most two proper ideals. Those I would consider pathological in this context.
I'd be happy to restrict to complex algebras if that is useful.
Also, is there a name for rings with this property?

Edit: In order to make the question more answerable, let's just consider the case $R=\mathbb Z$. Can we find ideals in $\mathbb Z$ such that the above sequence is not exact, or can we prove that this is impossible?
 A: I can see that your property does hold in $\mathbb{Z}$. In fact, it holds in any principal ideal domain, and even in every Dedekind domain.
[Edit: As pointed out by Rasmus below, for the commutative case, the property is equivalent to the ring being arithmetical. This is because arithmetical rings are defined by the distributive lattice property I state in (2) below. So, for integral domains, the property is equivalent to the ring being Prüfer. This certainly includes all Dedekind domains and, in the case of Noetherian domains, it is actually equivalent to the ring being Dedekind.]
I think it's just as easy to start by considering an arbitrary ring $R$. Choosing any $x\in\bigoplus_kI_k$ such that $g(x)=0$, then we have $x_1=-\sum_{k\ge2}x_k\in I_1\cap\sum_{k\ge2}I_k$. Conversely, if $x_1\in I_1\cap\sum_{k\ge2}I_k$ then this can be extended to an $x\in\bigoplus_kI_k$ with $g(x)=0$.
We want this to mean that there exists a $y\in\bigoplus_{j < k}I_j\cap I_k$ with $f(y)=x$. This implies that $x_1=\sum_{k\ge2}y_{1k}\in\sum_{k\ge2}I_1\cap I_k$. So, a necessary condition for the given sequence to be exact in the middle is that
$$
I_1\cap\sum_{k=2}^nI_k\subseteq\sum_{k=2}^nI_1\cap I_k.\qquad\qquad{\rm(1)}
$$
The reverse inclusion is immediate for any ring. In particular, just considering $n=3$ gives the necessary condition
$$
I\cap(J+K)=I\cap J+ I\cap K,\qquad\qquad{\rm(2)}
$$
for all ideals $I,J,K\subseteq R$. In fact, this is both a necessary and sufficient condition. It can be seen that your original condition and (2) are both just statements about a collection of subgroups of an abelian group (here, the group is $R$ under addition and the subgroups are the ideals). In fact, you are asking when the first homology group of a specific chain complex vanishes (much like in Cech cohomology). Also, (2) is the same as saying that the ideals form a distributive lattice $({\rm Id}_R,+,\cap)$. However, I'm no expert in this, and don't know what the name of rings satisfying your particular condition is (Edit: In the commutative case, these are arithmetical rings as mentioned above and in a comment below).
To see that (2) implies (1), use induction for $n\ge2$,
$$
I_1\cap\sum_{k=2}^nI_k=I_1\cap\sum_{k=2}^{n-1}I_k+I_1\cap I_n=\sum_{k=2}^nI_1\cap I_k.
$$
To see that (1) implies exactness, consider $x\in\bigoplus_kI_k$ with $g(x)=0$. Then, $x_n\in I_n\cap\sum_{k < n}I_k=\sum_{k < n}I_k\cap I_n$. So, there will be a $y\in\bigoplus_{j < k}I_j\cap I_k$ with $y_{jk}=0$ for $j < k < n$ and $f(y)_n=x_n$. Replacing $x$ by $\tilde x=x-f(y)$ reduces to the case with $\tilde x_n=0$, so exactness follows by induction on $n$.
Finally, (2) holds in any Dedekind domain. It is clear if any of $I,J,K$ are zero, so suppose that they are nonzero. For any ideal $I$ and nonzero prime ideal $\mathfrak{p}$, write $v_{\mathfrak{p}}(I)$ for the index of $\mathfrak{p}$ in the factorization of $I$ (the $\mathfrak{p}$-adic valuation). Two nonzero ideals $I,J$ are equal if and only if $v_{\mathfrak{p}}(I)=v_{\mathfrak{p}}(J)$ for all primes $\mathfrak{p}$. Then, using $v_{\mathfrak{p}}(I+J)=\min(v_{\mathfrak{p}}(I),v_{\mathfrak{p}}(J))$ and $v_{\mathfrak{p}}(I\cap J)=\max(v_{\mathfrak{p}}(I),v_{\mathfrak{p}}(J))$ implies that (2) holds.
