The question is to find the value of —
$$\sum_{r=1}^{502} \Big \lfloor \frac{305r}{503}\Big \rfloor$$
The answer is pretty big, so I don't think trial and error will work here. I seriously can't come up with a solution to this problem. I have asked plenty of floor function questions (you can check my profile), but this one is quiet different. Can someone please help me out? Even a hint is greatly appreciated.
Here is one way: use Pick's theorem on the triangle with vertices $(0,0), (503,0), (503,305)$.
Or you can do it more algebraically by noting $$ \left\lfloor\frac{305 r}{503}\right\rfloor + \left\lfloor\frac{305(503-r)}{503}\right\rfloor = 305-1=304 $$ for all $1\leq r\leq 502$ (since $503$ is prime).