How lengths of wars influence nations' military