/* * 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 ctu_main; import java.math.BigInteger; import java.util.Scanner; /** * * @author mrena */ public class Barrels { static BigInteger fct(int n) { BigInteger res = new BigInteger("1"); for (int i = 2; i < n + 1; ++i) { res = res.multiply(new BigInteger(i + "")); } return res; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int K = sc.nextInt(); int C = sc.nextInt(); if (C != A && C != B) { System.out.println("0"); return; } if (A == B) { System.out.println(K + ""); return; } BigInteger res = new BigInteger("0"); BigInteger mod = new BigInteger("1000000007"); BigInteger fK = fct(K); BigInteger fI = new BigInteger("1"); BigInteger fKmI = new BigInteger(fK.toString()); for (int i = 1; i < K + 1; i++) { fI = fI.multiply(new BigInteger(i + "")); fKmI = fKmI.divide(new BigInteger((K + 1 - i) + "")); res = res.add(new BigInteger(i + "").multiply(fK).divide(fI).divide(fKmI)); } System.out.println(res.mod(mod).toString()); } }