solve multofn