can now calculate sum of interval, not compiling and linking with makefile