How do I calculate the amount of money I get from an investor and the percentage I give him in return?
Well basically it pretty easy to calculate:

A + B + C = X

A:  0.25X : 25% of the company for investors

B:  0.5X : 50% you want to be left with

C:  1M : The price for selling to third party

X:  The value of the company that we would like to find

So in your case it's:

0.25X + 0.5X + 1M = X ->
0.25X = 1M -> 
X = 4