// General imports

import java.io.*;
import java.math.*;
import java.util.*;

public class Minesweeper {
  static char[][] input;
  static int poss = 0;
  static int[][] safe;
  static int r;
  static int c;
  static int b;

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    // Write code here

    r = sc.nextInt();
    c = sc.nextInt();
    b = sc.nextInt();

    input = new char[r][c];
    safe = new int[r][c];

    for (int i = 0; i < r; i++) {
      String s = sc.next();
      for (int j = 0; j < c; j++) {
        input[i][j] = s.charAt(j);
        safe[i][j] = 0;
      }
    }

    sc.close();

    solve(0, input, 0);
    if (poss == 0) {
      System.out.println("0.000");
    } else {
      double maxProb = (double) safe[0][0] / (double) poss;

      for (int i = 0; i < safe.length; i++) {
        for (int j = 0; j < safe[i].length; j++) {
          maxProb = Math.max(maxProb, (double) (safe[i][j]) / (double) poss);
        }
      }

      String s = String.format("%.3f", maxProb);
      System.out.println(s);
    }
  }

  public static void solve(int index, char[][] grid, int bombs) {
    if (index >= r * c) {
      if (bombs == b && isValid(grid)) {
        addPoss(grid);
      }
      return;
    }

    int row = (int) Math.floor(index / c);
    int col = (index % c);

    if (bombs > b)
      return;

    char[][] gridCopy = new char[r][c];

    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        gridCopy[i][j] = grid[i][j];
      }
    }

    if (gridCopy[row][col] == '#') {
      gridCopy[row][col] = 'b';
      solve(index + 1, gridCopy, bombs + 1);
      gridCopy[row][col] = '#';
      solve(index + 1, gridCopy, bombs);
    } else {
      solve(index + 1, gridCopy, bombs);
    }

    return;
  }

  public static boolean isValid(char[][] grid) {
    for (int i = 0; i < grid.length; i++) {
      for (int j = 0; j < grid[i].length; j++) {
        if (Character.isDigit(grid[i][j])) {
          int total = grid[i][j] - '0';
          int cand = 0;
          for (int l = -1; l <= 1; l++) {
            for (int m = -1; m <= 1; m++) {
              if (i + l < grid.length && i + l >= 0 && j + m < grid[i].length && j + m >= 0) {
                if (grid[i + l][j + m] == 'b')
                  cand++;
              }
            }
          }
          if (cand != total)
            return false;
        }
      }
    }
    return true;
  }

  public static void addPoss(char[][] grid) {
    poss++;
    for (int i = 0; i < grid.length; i++) {
      for (int j = 0; j < grid[i].length; j++) {
        if (grid[i][j] == '#') {
          safe[i][j]++;
        }
      }
    }
  }
}
