Sn=a(1-r^n)------1-r

Un= ar^(n-1) (i think off the top of my head)

315=a(1-r^n)

-------1-r

5th term:

U5=ar^4

U6=ar^5

U7=ar^6

so

80640=ar^4 + ar^5 + ar^6

80640=ar^4(1-r^3)----------1-r

Hopefully by solving the simultaneous equation you can get a and r, then go back to your original equation (with 315) to find n