A simple derivation of Mason's gain formula