Use the slope formula
y2-y1
m=---------
x2-x1
(rise-->y over run-->x)
so it would be
9-5
m=-------
1-10
and that would simplify to
4
----
-9
and that would be your slope.
Hope that helped :-)
Just work with it as seperate triangles and then add them up.
A number(p) plus six
six plus a number(p)
2^3=2*2*2
2*2*2+4*8
8+32
=> 40