compute contract total length