Best in my opinion to improve your diet for a few weeks/months before undergoing a lengthy fast, as the safety of a fast is entirely dependent on the quality or otherwise of your food reserves.
It is also said that a fast is in vain unless the living and esp' eating habits post-fast are sound.