#include <stdio.h>

int main() {
    int m, n;
    while (~scanf("%d %d", &m, &n)) {
        int* arr = (int*)malloc(sizeof(int) * m * n * 2 - 1);
        int count = 0;
        for (int i = 0; i < m * n * 2 ; i++) {
            scanf("%d", &arr[i]);
        }
        for (int j = 0; j < m * n; j++) {
            if (arr[j] == arr[j + m * n])
                count++;
        }
        printf("%.2f", (float)count / (m * n) * 100);

    }
    return 0;
}