C++ Solution
```\nint dp[35][25];\n    int fnd(int n, int r)\n    {\n        if(n<r || r<0)\n            return 0;\n        if(n==1 || n==r || r==0)\n            return 1;\n
```\nint dp[35][25];\n    int fnd(int n, int r)\n    {\n        if(n<r || r<0)\n            return 0;\n        if(n==1 || n==r || r==0)\n            return 1;\n        if(dp[n][r]!=-1)\n            return dp[n][r];\n        return dp[n][r]=fnd(n-1,r)+fnd(n-1,r-1);\n    }\n    string kthSmallestPath(vector<int>& d, int k) {\n        string ans;\n        memset(dp,-1,sizeof(dp));\n        int h=d[1],v=d[0],t=h+v;\n        while(t>0)\n        {\n            long hf=h<=0?1:fnd(h+v-1,v);\n            cout<<hf<<" ";\n            if(k>hf)\n            {\n                k-=hf;\n                ans+=v>0?\'V\':\'H\';\n                v--;\n            }\n            else\n            {\n                ans+=h>0?\'H\':\'V\';\n                h--;\n            }\n            t--;\n        }\n        return ans;\n    }
[]