#include <iostream>#include <math.h>#include <stdio.h>#include <complex>#include <vector>#include <string>#include <sstream>using namespace std;complex < double > g( string a ){int f = 1;string s = "", t = "";for( int i = 1 ; i+1 < a.size() ; i ++ )if( a[i] == ',' )f = 0;else if( f )s += a[i];elset += a[i];stringstream ss( s );double x, y;ss >> x;ss.clear();ss.str( t );ss >> y;return complex < double > ( x , y );}vector < complex < double > > f( string a ){vector < complex < double > > r;for( int i = 0 ; i < a.size() ; i ++ ){string s = "";while( i < a.size() && a[i] != ' ' )s += a[i], i ++;r.push_back( g( s ) );}return r;}double dis( complex < double > a , complex < double > b ){return sqrt( ( a.real() - b.real() ) * ( a.real() - b.real() ) + ( a.imag() - b.imag() ) * ( a.imag() - b.imag() ) );return sqrt( abs( a - b ) );}int main(){int n;string s, t, pp;vector < complex < double > > a, b;while( getline( cin , s ) , s.size() ){getline( cin , t );a = f( s );b = f( t );getline( cin , pp );stringstream ss( pp );double p = 0.0;ss >> p;double c = 0.0;for( int i = 0 ; i < a.size() ; i ++ )c += pow( dis( a[i] , b[i] ) , p );c = pow( c , 1./p );printf( "%.10lfn" , c );}}


