Let $A,B$ be two $R$-modules over a commutative ring $R$ (restrict to $R = \mathbb{Z}$ or $R= \mathbb{K}$ a field where appropriate). Suppose $A$ and $B$ fit into an exact sequence
$0 \to R^p \to A \to R^r \to R^q \to B \to 0$
for integers $p,q,r > 0$, where $R^{n} = R \oplus R ... \oplus R$ ($n$-times). Then what can be said about $A$ and $B$? Specifically,
1) Are there any cases where $A$ and $B$ be computed (most generally in terms of $p,q,r$)?
If not
2) Given an allowed $B$ what can be said about $A$?
3) Given an allowed $A$ what can be said about $B$?