/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package beerbarrels; import java.util.Scanner; /** * * @author boban3 */ public class Main { public static int a, b, k, c, vysledok; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextLine()) { String[] riadok = sc.nextLine().split(" "); a = Integer.parseInt(riadok[0]); b = Integer.parseInt(riadok[1]); k = Integer.parseInt(riadok[2]); c = Integer.parseInt(riadok[3]); vysledok = 0; long pocetVyskytov = 0; if (a != c && b != c) { System.out.println("0"); continue; } if (a == b) { System.out.println(k); continue; } for (int i = k; i >= 0; i--) { long hore = 1; for (int j = k; j >= 1; j--) { hore *= j; hore %= 1000000007; } long dole1 = 1; for (int j = i; j >= 1; j--) { dole1 *= j; dole1 %= 1000000007; } long dole2 = 1; for (int j = k - i; j >= 1; j--) { dole2 *= j; dole2 %= 1000000007; } if (dole1 == 0) dole1 = 1; if (dole2 == 0) dole2 = 1; int nasobok; if (a == c) { nasobok = i; } else { nasobok = k - i; } long dole = (dole1 * dole2) % 1000000007; pocetVyskytov += (hore / (dole)) * nasobok; } System.out.println(pocetVyskytov % 1000000007); } } }