input: from typing import List
  
  def calculate_power_sum(nums: List[int], k: int) -> int:
      """
      Given an integer list nums of length n and a positive integer k,
      define the power of nums as the number of subsequences with a sum equal to k.
      
      Return the power sum of all subsequences of nums, modulo 10^9 + 7.
  
      Examples:
      >>> nums = [1,2,3], k = 3
      6
      >>> nums = [2,3,3], k = 5
      4
      >>> nums = [1,2,3], k = 7
      0
  
      Constraints:
      1 <= n <= 100
      1 <= nums[i] <= 10^4
      1 <= k <= 100
      """
output:     
      MOD = 10**9 + 7
  
      def count_subsequences_with_sum(nums, k):
          n = len(nums)
          dp = [[0] * (k + 1) for _ in range(n + 1)]
          dp[0][0] = 1
  
          for i in range(1, n + 1):
              for j in range(k + 1):
                  dp[i][j] = dp[i - 1][j]
                  if j >= nums[i - 1]:
                      dp[i][j] = (dp[i][j] + dp[i - 1][j - nums[i - 1]]) % MOD
                      
          return dp[n][k]
  
      return count_subsequences_with_sum(nums, k)
  