Took me a total of 2:36 to solve! 95% of the time, i kinda wasted trying to think of solutions. After thinking of this solution, it only took 16 seconds to solve xD
All me (apparently, this is very similar to @kriblo's solution) Sorry if this explanation isn't in very exact mathematical terms (P.s. i'm a 6th grader)