Retirement tax questions

I had read some place that the calculation in order to compute the penalty for withdrawing money that was not used for college expenses is: account contributions/account value x distribution = contribution portion and that the original contribution would never be penalized.  Is this calculation correct?