#!/usr/bin/env python

"""
Hackerrank Solution
-
<NAME>
<@natebwangsut | <EMAIL>>
"""

__author__ = "<NAME>"
__credits__ = ["<NAME>sutthitham"]
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"

import itertools

line = input()
line = input().split()
repeat = int(input())

com = list(itertools.combinations(line, repeat))

print(sum(("a" in x) for x in com) / len(com))

#!/usr/bin/env python

"""
Hackerrank Solution
-
<NAME>
<@natebwangsut | <EMAIL>>
"""

__author__ = "<NAME>"
__credits__ = ["<NAME>sutthitham"]
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"

import itertools

line = input()
line = input().split()
repeat = int(input())

com = list(itertools.combinations(line, repeat))

print(sum(("a" in x) for x in com) / len(com))

#!/usr/bin/env python Hackerrank Solution - <NAME> <@natebwangsut | <EMAIL>>