Just a runnable solution
\n\nimpl Solution {\n    pub fn sum_of_power(nums: Vec<i32>, k: i32) -> i32 {\n        let n = nums.len();\n        let nums = nums.iter().map(|&x| x as i64).co
\n```\nimpl Solution {\n    pub fn sum_of_power(nums: Vec<i32>, k: i32) -> i32 {\n        let n = nums.len();\n        let nums = nums.iter().map(|&x| x as i64).collect::<Vec<i64>>();\n        let mut dp = vec![vec![vec![-1; 101]; 101]; 101];\n        (Self::fun(&mut dp, n, 0, 0, 0, &nums, k as _) % 1_000_000_007) as _\n    }\n\n    fn power(x: i64, y: usize, p: i64) -> i64 {\n        let mut res = 1;\n        let mut x = x % p;\n        if x == 0 {\n            return 0;\n        }\n        let mut y = y;\n        while y > 0 {\n            if y & 1 == 1 {\n                res = (res * x) % p;\n            }\n            y >>= 1;\n            x = (x * x) % p;\n        }\n        res\n    }\n\n    fn fun(dp: &mut Vec<Vec<Vec<i64>>>, n: usize, ind: usize, sum: i64, cnt: i64, nums: &Vec<i64>, k: i64) -> i64 {\n        if ind >= n {\n            if sum == k {\n                return Self::power(2, n - cnt as usize, 1_000_000_007) % 1_000_000_007;\n            }\n            return 0;\n        }\n\n        if dp[ind][sum as usize][cnt as usize] != -1 {\n            return dp[ind][sum as usize][cnt as usize];\n        }\n\n        let sum1 = Self::fun(dp, n, ind + 1, sum, cnt, nums, k) % 1_000_000_007;\n        let sum2 = if sum + nums[ind] <= k {\n            Self::fun(dp, n, ind + 1, sum + nums[ind], cnt + 1, nums, k) % 1_000_000_007\n        } else {\n            0\n        };\n\n        dp[ind][sum as usize][cnt as usize] = (sum1 + sum2) % 1_000_000_007;\n        dp[ind][sum as usize][cnt as usize]\n    }\n}\n```
['Rust']