You are given a binary string S and an integer K. You are allowed to perform at most K flip operations (changing a 0 to a 1 or a 1 to a 0). Find the minimum number of inversions the string can have after performing at most K flips.
(Note: An inversion in a binary string is a pair of indices (i,j) such that i < j and S[i] > S[j], i.e., a 1 appears before a 0.)
The first line contains the binary string S. The second line contains the integer K.
Print a single integer representing the final number of inversions.
Input:
Input: