Do you have photoshop or can you download a 30-day trial? That might be the way to go, because I don't know how well other stitching programs will handle 40 files. In PS, you can have them all together and always have the flexibility of moving or resizing each one to best fit the big picture.
__________________
|