output_description: If A is a divisor of B, print A + B; otherwise, print B - A.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B
attempt: n, m = map(int, input().split())
  mt = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
  a = sorted(map(int, input().split()))
  dp = [""] * (n + 1)
  dp[0] = "*"
  for i in range(n + 1):
      if not dp[i]:
          continue
      for j in a:
          if i + mt[j] < n + 1:
              dp[i + mt[j]] = str(j) + dp[i]
  print("".join(sorted(dp[-1][:-1])[::-1]))
  
problem_description: Statement
  
  You are given positive integers A and B.
  
  If A is a divisor of B, print A + B; otherwise, print B - A.
samples: [{"input": "4 12", "output": "16\n    \n\nAs 4 is a divisor of 12, 4 + 12 = 16 should be printed.\n\n* * *"}, {"input": "8 20", "output": "12\n    \n\n* * *"}, {"input": "1 1", "output": "2\n    \n\n1 is a divisor of 1."}]