How can someone from a developing country study pure mathematics/theoretical physics at a university abroad? The quality of university level education in developing countries (North Africa in my case) is mediocre at best, especially in the sciences (my interests lie primarily in mathematics). I've found that the appropriate places for getting this education would be France or Russia, more specifically ENS and l'École Polytechnique in Paris (I'm aware that going to the classes préparatoires aux grandes écoles is strongly advised, but how can I avoid going there if possible?) and the National Research University Higher School of Economics in Moscow (which teaches in Russian which I will vigorously try to learn). 

Can I study in my original country for a little while then go there? How do each of them cost? How can I proceed to achieve this almost impossible goal?
If you know of any other good mathematical institution that accepts student from North africa, please suggest it.
The African Institute for Mathematics (http://www.aims.ac.za/) is an institution meant to help those in your situation. Essentially, it is supposed to offer talented budding mathematicians from Africa the fundamentals to be competitive to apply to the top places all over the world.