Some simple algebra. Those variables are basically the instructions. So read them now. Please do not be silly, I mean, don't do something that does not say what the variables (,the instructions,) say. Thanks.
Credit to many Scratchers who had a similar project like this. I did the scripts by myself. Time took: 30 minutes. Shared: 14th May 2014. Edits: