Retirement tax questions

Thank you very much for taking time answering my question.
First, RMD stands for Required minimum distribution of the IRAs. How come it has nothing to do with an IRA distribution?
Let me simplify my question. Say  all my IRA values at the 2016 year end are $1000,  my IRA basis is $100 and I reach 70.5 in 2016. My RMD for 2017 is 1000/27.4, which equals 36.5.  The ratio of basis/value is 10%.  So my taxible RMD is 32.85.  If I am still working and put $1000 in my SEP ira in 2017, the 2017 year end value is 1963.5. If I use the 2017 year end value, the ratio will be 5%. So my taxible RMD will be 34.68, more than 32.85. If I do not contribution more money to my SEP ira and the market goes down south in 2017, I may end up with 500 for the values of 2017 year end ira.  If I use the 2017 year end value,  my taxible RMD will be lower then what it should be.
When one takes 2 year RMDs in one year, the situation becomes more complicated.
I hope you can understand my question now.