Towards automatic analytic evaluation of diagrams with masses