# -*- coding:utf-8 -*-
"""
A 
"""
class StringFormat:
    def formatString(self, A, n, arg, m):
        # write code here
        res=""
        left=0
        right=0
        while left<n and right <m:
            if A[left]=='%':
                res=res+arg[right]
                left+=2
                right+=1
            else:
                res=res+A[left]
                left+=1
        if right<n:
            temp=arg[right:]
            res+="".join(temp)
        return res